The engine MUST read the literals DATE '...', TIME '...', TIMESTAMP '...' and INTERVAL '...' unit (a single unit, YEAR TO MONTH, DAY TO HOUR, DAY TO MINUTE, DAY TO SECOND, HOUR TO MINUTE, HOUR TO SECOND and MINUTE TO SECOND, and an interval of words, INTERVAL '1 year 2 months', or of ISO 8601), and CAST(x AS DATE | TIME | TIMESTAMP | INTERVAL) (a date from a timestamp keeps its day, a timestamp from a date is its midnight, a time from a timestamp its time of day), with an error value for a text that is not what it is said to be; it MUST do date + interval, date - interval, timestamp ± interval (months by the calendar, a day past the end of a month going to its last day), date ± n (days), interval ± interval, interval * n, n * interval, interval / n, -interval, date - date (a number of days), and timestamp - timestamp and time - time (an interval), a date plus an interval with a time part being a timestamp; and EXTRACT(field FROM x) of a date or a timestamp (YEAR, QUARTER, MONTH, WEEK (ISO), DAY, DOW, ISODOW, DOY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, EPOCH), of a time (HOUR, MINUTE, SECOND, EPOCH) and of an interval (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, EPOCH), a null giving a null and a field that the value has not being an error value; a type with a time zone MUST be an error value.
Enforced (check): .github: cd commons/lang-sql && bun run verify — suite/relational.test.ts: date and time literals, casts and arithmetic follow the calendar: months clamp to the end of a month, a date plus an interval with a time is a timestamp, differences are days or intervals, and what is not a date is an error value; suite/relational.test.ts: EXTRACT reads the parts of a date, a timestamp, a time and an interval, and a null gives a null
Proved by: lang-sql/suite/relational.test.ts
Tests: passed: suite/relational.test.ts EXTRACT reads the parts of a date, a timestamp, a time and an interval, and a null gives a; passed: suite/relational.test.ts date and time literals, casts and arithmetic follow the calendar: months clamp to the end