ymd>ordinal ( year month day -- ordinal )


Vocabulary
calendar

Inputs
yearan object
monthan object
dayan object


Outputs
ordinalan object


Definition


: ymd>ordinal ( year month day -- ordinal )
[ leap-year? dup -2 -3 ? ] [
dup 3 < [ 12 + ] when
[ 1 - 30 * ] [ 1 + 0.6 * floor ] bi +
] [ ] tri* + + >integer swap 367 366 ? mod ;