Remaster is a language-independent library design framework. It enables language designers to reuse a good design decision for the standard library, and provides a metadata for language bindings. It is not an initiative to replace the existing standard library, nor make the common standard library (what CLI and JVM has done).
This document is very early draft and subject to change.
weekday
A set of weekdays.
monday
or mon
= 0: int
Monday.
tuesday
or tue
= 1: int
Tuesday.
wednesday
or wed
= 2: int
Wednesday.
thursday
or thu
= 3: int
Thursday.
friday
or fri
= 4: int
Friday.
saturday
or sat
= 5: int
Saturday.
sunday
or sun
= 6: int
Sunday.
date
Represents a single date in the Gregorian calendar. For the dates before the Gregorian calendar exists it uses the extended version of Gregorian calendar. For the conversion between Gregorian calendar with other calendar systems see julian date
.
[get] min date
(): date
Returns the minimum possible date value.
[get] max date
(): date
Returns the maximum possible date value.
[is] leap year
(year
: int
): bool
Returns true when given year is a leap year, in the Gregorian calendar.
[make] date [from date]
(year
: int
, month
: int
, day
: int
): date
or errorCreates a new date
value from given year, month and day of the month.
[make] date [from week date]
(week
: ISO week
, dow
or day
: weekday
): date
or errorCreates a new date
value from given ISO week and day of the week.
[make] date [from ordinal date]
(year
: int
, doy
or day
: int
): date
or errorCreates a new date
value from given year and day of the year.
[get] year
(self: date
): int
Returns the year.
[get] month
(self: date
): int
Returns the month.
[get] day
(self: date
): int
Returns the day of the month.
[get] ISO week
(self: date
): ISO week
Returns the ISO week that contains given date.
[get] weekday
(self: date
): weekday
Returns the day of the week.
[get] day of year
(self: date
): int
Returns the day of the year.
[to string]
(self: date
): string
Returns the string representation, or more explicitly, ISO 8601 date representation (YYYY-MM-DD
) of given date.
[difference]
(self: date
, other: date
): duration
Returns the difference between two dates.
[difference] [in days]
(self: date
, other: date
): int
Returns the difference between two dates, in days.
[increase]
(self: date
): date
or errorIncreases given date by one day.
[decrease]
(self: date
): date
or errorDecreases given date by one day.