Expand/Shrink

is_leap_year

Definition: bool b = is_leap_year(object y)
Description: y: a year such as 2022, or a result from date() or a timedate.
Returns true (1) if the year is a leap year, false (0) otherwise.
pwa/p2js: Supported.
Comments: Uses the proper rules for years divisible by 4, 100, and 400.

Obviously this functionality is required as part of date(), and has been made available for general use.

Not suitable for use with years prior to the introduction of the Gregorian calendar.
Returns 0 if y < 1752.
Example:
?apply({2015,2016,1900,2000,2004},is_leap_year)
-- prints {0,   1,   0,   1,   1}
--  or {false,true,false,true,true} under pwa/p2js
Implementation: See builtins\pdates.e (an autoinclude) for details of the actual implementation.
See Also: date, time, apply