Type Alias: TimeInput
TimeInput =
Time|Date|string|number| (number|string)[] |null
A time accepted by new Time() and the methods comparing times:
null(or nothing): now;- a
Time: its instant and its time zone; aDate: its instant; - a number: milliseconds since the Unix epoch (the string of an integer or a decimal number too,
'1700000000000'); - a string: a date as
Dateparses it. WithZor an offset ('2024-03-01T07:30:00+08:00'), or a zone nameDateknows ('GMT','EST'), it is that instant; without one ('2024-03-01','2024-03-01 07:30','March 1, 2024 07:30'), it is the wall clock in the time zone of theTimereading it: the default zone fornew Time(), the instance's zone for its comparisons anddiff; - an array: the wall clock fields
[year, month, date, hours, minutes, seconds, milliseconds], in the same time zone as a string without offset, the month from 0 (January) to 11; the missing leading fields are the current ones ([]is today,[undefined, 5]June of this year), the missing trailing fields their smallest ([2024]is January 1st 2024 at midnight); a field out of its range ([2023, 1, 29]) gives an invalid time.
A wall clock time read in a time zone which skips it (02:30 when the clocks jump from 02:00 to 03:00) moves forward by the length of the gap (03:30); one which is repeated (the clocks turned back) is the earlier one.