} [ 2020 366 year-ordinal>timestamp >gmt midnight ] unit-test
{ t } [
- 2020 <year> timestamp>year-dates
+ 2020 <year> timestamp>year-dates-gmt
[ >date< ymd>ordinal ] map [ < ] monotonic?
] unit-test
{ t } [
1999 2025 [a,b] [
- <year> timestamp>year-dates
+ <year> timestamp>year-dates-gmt
[ >date< ymd>ordinal ] map [ < ] monotonic?
] map [ ] all?
] unit-test
{ t } [
1999 2025 [a,b] [
- <year-gmt> timestamp>year-dates
+ <year-gmt> timestamp>year-dates-gmt
[ >date< ymd>ordinal ] map [ < ] monotonic?
] map [ ] all?
] unit-test
{ t } [
2014 1 1 <date-gmt>
- 2014 <year-gmt> timestamp>year-dates
+ 2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map [ <= ] monotonic?
] unit-test
{ t } [
2020 1 1 <date-gmt>
- 2020 <year-gmt> timestamp>year-dates
+ 2020 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map [ <= ] monotonic?
] unit-test
{ t } [
2014 1 1 <date-gmt>
- 2014 <year-gmt> timestamp>year-dates
+ 2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map
dup 1 tail swap v- [ 1 <= ] all?
] unit-test
{ t } [
2020 1 1 <date-gmt>
- 2020 <year-gmt> timestamp>year-dates
+ 2020 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map
dup 1 tail swap v- [ 1 <= ] all?
] unit-test
{ 0 } [
2014 1 1 <date-gmt>
- 2014 <year-gmt> timestamp>year-dates
+ 2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between2 ] with map
2014 1 1 <date-gmt>
- 2014 <year-gmt> timestamp>year-dates
+ 2014 <year-gmt> timestamp>year-dates-gmt
[ weekdays-between ] with map
v- sum
[ ] tri* + + >integer
swap 367 366 ? mod ;
-: timestamp>year-dates ( timestamp -- seq )
+: timestamp>year-dates-gmt ( timestamp -- seq )
[ start-of-year >date< julian-day-number ]
[ days-in-year ] bi
[ drop ] [ + ] 2bi
- [a..b) [ julian-day-number>date <date> ] map ;
+ [a..b) [ julian-day-number>date <date-gmt> ] map ;
: year-ordinal>timestamp ( year ordinal -- timestamp )
[ 1 1 julian-day-number ] dip
{ year 2020 }
{ month 1 }
{ day 1 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 1 }
{ day 20 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 2 }
{ day 17 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 5 }
{ day 25 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 7 }
{ day 3 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 9 }
{ day 7 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 10 }
{ day 12 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 11 }
{ day 11 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 11 }
{ day 26 }
- { gmt-offset T{ duration { hour -6 } } }
}
T{ timestamp
{ year 2020 }
{ month 12 }
{ day 25 }
- { gmt-offset T{ duration { hour -6 } } }
}
}
} [
- 2020 <year> timestamp>year-dates [ us-federal holiday? ] filter
+ 2020 <year-gmt> timestamp>year-dates-gmt [ us-federal holiday? ] filter
] unit-test
\ No newline at end of file