Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
MichelJuillard
Periods.jl
Commits
a8d1eab6
Commit
a8d1eab6
authored
Mar 02, 2020
by
Michel Juillard
Browse files
initial files
parents
Changes
3
Hide whitespace changes
Inline
Side-by-side
Project.toml
0 → 100644
View file @
a8d1eab6
name
=
"Periods"
uuid
=
"0c1d1a06-9168-427d-90e3-b4d73349562f"
authors
=
[
"michel "
]
version
=
"0.1.0"
src/Periods.jl
0 → 100644
View file @
a8d1eab6
module
Periods
include
(
"SimplePeriods.jl"
)
end
# module
src/SimplePeriods.jl
0 → 100644
View file @
a8d1eab6
@enum
Frequency
Year
Semester
Quarter
Month
Week
Business
Day
struct
SimplePeriod
ordinal
::
Int64
frequency
::
Frequency
end
function
SimplePeriod
(
year
,
subperiod
,
frequency
)
if
frequency
==
Year
ordinal
=
year
-
1970
elseif
frequency
==
Semester
@assert
(
subperiod
in
1
:
2
)
ordinal
=
2
*
(
year
-
1970
)
+
subperiod
-
1
elseif
frequency
==
Quarter
@assert
(
subperiod
in
1
:
4
)
ordinal
=
4
*
(
year
-
1970
)
+
subperiod
-
1
elseif
frequency
==
Month
@assert
(
subperiod
in
1
:
12
)
ordinal
=
12
*
(
year
-
1970
)
+
subperiod
-
1
elseif
frequency
==
Week
ordinal
=
week1970
(
year
,
week
)
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment