Feel.Analysis.Images.Temporal (feel v0.1.0)

Copy Markdown View Source

The rules for the functions of Feel.Builtin.Temporal (Feel.Analysis.Images, D-161, step C): day of week, day of year, is, month of year, now, today and week of year.

FunctionThe type of the result
now()a date and time with a zone (the offset of the clock of the run), and never null
today()a date, never null
day of week(d)the names of the weekdays of the days of d: "Monday" to "Sunday"
month of year(d)the names of the months of the days of d
day of year(d)the numbers [1..366] that the days of d have
week of year(d)the numbers [1..53] that the days of d have, as the weeks of ISO 8601 count them
is(a, b)a boolean, never null; false if no value of one is the same as a value of the other

The argument of the four calendar functions is a date or a date and time, whose fields are read as they are written (the day of a date and time is that of its clock, D-109), or a list of one of them, which is the one (section 10.3.2.9.4). So the type of the result is the one the days of the type of the argument have: the set of a date is a set of days (D-109), and that of a date and time is a set of seconds on the lines of its clocks (Feel.Type.Moment), of which the days are taken. A date in January 2021 is a day of week in the set of the days of that month, and a day of year in [1..31]. The result is null only for an argument that is no date: null, a value of another kind, a list that does not have exactly one item (a type does not say how many a list has), or a value of a type that is not known.

A range of days of a week has every weekday, and one of a year (366 days) every month; a shorter one is counted day by day. The days of the year are those that each year the range touches has in it, and the weeks of a range of up to 3,000 days are counted a week at a time. Past that the range has every day of the year (a leap year ends in the 366th within 2,921 days) and every week (the weeks of a year that has 53 are not apart by more than 2,548 days), and both are tested against the run for every day of ranges of every length up to that.