2 Dates
Gregor provides a date struct that represents a calendar date without a time or time zone. Unfortunately, the name date conflicts with an existing, incompatible definition in racket/base.
The author of this package considered other names, including Date (with a capital D) and local-date (à la Joda-Time) but in the end decided to live with the incompatibility. Gregor’s date, along with its companion data structures (time, datetime, and moment) should be considered a replacement of, not a supplement to, the built-in Racket date.
procedure
year : exact-integer? month : (integer-in 1 12) = 1 day : (day-of-month/c year month) = 1
> (date 1941 12 7) #<date 1941-12-07>
> (date 1965 7) #<date 1965-07-01>
> (date 1970) #<date 1970-01-01>
procedure
jdn : exact-integer?
procedure
(date->iso8601 d) → string?
d : date?
> (date->iso8601 (date 1941 12 7)) "1941-12-07"
> (date->iso8601 (date 1965 7)) "1965-07-01"
> (date->iso8601 (date 1970)) "1970-01-01"
procedure
x : date? y : date?
procedure
x : date? y : date?
procedure
x : date? y : date?
procedure
x : date? y : date?
procedure
x : date? y : date?
> (date=? (date 1970) (date 1970 1 1)) #t
> (date<? (date 1941 12 7) (date 1965 7)) #t
> (date>? (date 1492) (date 2015)) #f
value
> (date-order (date 1970) (date 1970 1 1)) '=
> (date-order (date 1941 12 7) (date 1965 7)) '<
> (date-order (date 2015) (date 1492)) '>
> (make-splay-tree date-order) #<compact-splay-tree*>