7.2

### 2Dates

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(date year [month day]) → date? year : exact-integer? month : (integer-in 1 12) = 1 day : (day-of-month/c year month) = 1
Constructs a date with the given year, month, and day.

Examples:
 > (date 1941 12 7) # > (date 1965 7) # > (date 1970) #

 procedure(date? x) → boolean? x : any/c
Returns #t if x is a date; #f otherwise.

 procedure(jdn->date jdn) → date? jdn : exact-integer?
Returns the date corresponding to the given Julian day number, which is the number of solar days that have elapsed since 12:00 UT on November 24, 4714 BC in the proleptic Gregorian calendar.

Examples:
 > (jdn->date 0) # > (jdn->date 2440588) #

 procedure d : date?
Returns an ISO 8601 string representation of d.

Examples:
 > (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(date=? x y) → boolean? x : date? y : date?
 procedure(date
 procedure(date<=? x y) → boolean? x : date? y : date?
 procedure(date>? x y) → boolean? x : date? y : date?
 procedure(date>=? x y) → boolean? x : date? y : date?
Comparison functions on dates.

Examples:
 > (date=? (date 1970) (date 1970 1 1)) #t > (date (date>? (date 1492) (date 2015)) #f

 value
An order defined on dates.

Examples:
 > (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) #