remove dynamic equality

This commit is contained in:
2025-06-16 13:48:09 -05:00
parent 9c0565d34f
commit 794baf8598
70 changed files with 462 additions and 461 deletions

View File

@@ -41,10 +41,10 @@ time.week2day = function() { return time.week / time.day; };
/* leap-year helpers */
time.yearsize = function yearsize(y)
{
if (y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0)) return 366;
if (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) return 366;
return 365;
};
time.isleap = function(y) { return time.yearsize(y) === 366; };
time.isleap = function(y) { return time.yearsize(y) == 366; };
/* timecode utility */
time.timecode = function(t, fps = 24)
@@ -64,7 +64,7 @@ function record(num = now(),
dst = computer_dst())
{
/* caller passed an existing record → return it verbatim */
if (typeof num === "object") return num;
if (typeof num == "object") return num;
/* -------------------------------------------------------------------- */
/* convert seconds-since-epoch → broken-down record */
@@ -107,7 +107,7 @@ function record(num = now(),
rec.yday = day;
/* month & month-day */
if (time.yearsize(y) === 366) monthdays[1] = 29;
if (time.yearsize(y) == 366) monthdays[1] = 29;
var m = 0;
for (; day >= monthdays[m]; m++) day -= monthdays[m];
rec.month = m;
@@ -119,7 +119,7 @@ function record(num = now(),
function number(rec = now())
{
/* fall through for numeric input or implicit “now” */
if (typeof rec === "number") return rec;
if (typeof rec == "number") return rec;
/* -------------------------------------------------------------------- */
/* record → seconds-since-epoch */
@@ -165,15 +165,15 @@ function text(num = now(),
zone = computer_zone(),
dst = computer_dst())
{
var rec = (typeof num === "number") ? record(num, zone, dst) : num;
var rec = (typeof num == "number") ? record(num, zone, dst) : num;
zone = rec.zone;
dst = rec.dst;
/* am/pm */
if (fmt.includes("a")) {
if (rec.hour >= 13) { rec.hour -= 12; fmt = fmt.replaceAll("a", "PM"); }
else if (rec.hour === 12) { fmt = fmt.replaceAll("a", "PM"); }
else if (rec.hour === 0) { rec.hour = 12; fmt = fmt.replaceAll("a", "AM"); }
else if (rec.hour == 12) { fmt = fmt.replaceAll("a", "PM"); }
else if (rec.hour == 0) { rec.hour = 12; fmt = fmt.replaceAll("a", "AM"); }
else fmt = fmt.replaceAll("a", "AM");
}