From cbe86892bee21e685ebd206ca4756e505720427a Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:20:32 -0500 Subject: [PATCH 01/11] more tests --- __tests__/Date/wtf.unit.spec.js | 72 +++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index b6850d8..4fd1c6e 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -349,6 +349,9 @@ describe('Date', () => { // 19 of 28 describe('new Date("maybe 1")', () => { beforeEach(() => { + // "may" in "maybe" is parsed as the month May! + // And for some reason this expression cares about your local timezone, + // which happens to be BST for me right now. oDate = new Date('maybe 1') dateString = oDate.toISOString() }) @@ -363,10 +366,73 @@ describe('Date', () => { }) xit('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000Z"', () => { - // "may" in "maybe" is parsed as the month May! - // And for some reason this expression cares about your local timezone, - // which happens to be BST for me right now. expect(dateString).toEqual('2001-05-01T00:00:00.000Z') }) }) + + // 20 of 28 + describe('new Date("fourth of may 2010")', () => { + beforeEach(() => { + // "fourth of" is ignored, + // this is just parsing "may 2010" + // and again local timezone is important. + oDate = new Date('fourth of may 2010') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') + }) + + it('does NOT equal "2010-05-04T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-05-04T00:00:00.000Z') + }) + + xit('parses "may 2010" as "2010-05-01T00:00:00.000Z", ignoring "fourth of"', () => { + expect(dateString).toEqual('2010-05-01T00:00:00.000Z') + }) + }) + + // 21 of 28 + describe('new Date("May 4 UTC")', () => { + beforeEach(() => { + // UTC is correctly parsed as a timezone. + oDate = new Date('May 4 UTC') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2010-04-30T23:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-04-30T23:00:00.000Z') + }) + + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') + }) + + it('parses UTC as "2001-05-04T00:00:00.000Z"', () => { + expect(dateString).toEqual('2001-05-04T00:00:00.000Z') + }) + }) + + // 22 of 28 + describe('new Date("May 4 UTC+1")', () => { + beforeEach(() => { + // You can add modifiers to timezones and it works as you would expect. + oDate = new Date('May 4 UTC+1') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') + }) + + it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') + }) + + it('parses UTC+1 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:00:00.000Z"', () => { + // 05-04T00 @ UTC+1 is 1 hr ahead: 05-03T23 @ UTC + expect(dateString).toEqual('2001-05-03T23:00:00.000Z') + }) + }) }) From 9062b1f4ce1b0ef0ac78b0682fd2e9666391dc47 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:23:14 -0500 Subject: [PATCH 02/11] d --- __tests__/Date/wtf.unit.spec.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 4fd1c6e..0d5f74c 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -435,4 +435,21 @@ describe('Date', () => { expect(dateString).toEqual('2001-05-03T23:00:00.000Z') }) }) + + // 23 of 28 + describe('new Date("May 4 UTC+1:59")', () => { + beforeEach(() => { + // It also supports minutes! + oDate = new Date('May 4 UTC+1:59') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') + }) + + it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:01:00.000Z"', () => { + expect(dateString).toEqual('2001-05-03T23:01:00.000Z') + }) + }) }) From 75f25b46e23a70c17c45d69a4fa3c22d1886dd99 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:27:15 -0500 Subject: [PATCH 03/11] dd --- __tests__/Date/wtf.unit.spec.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 0d5f74c..ed7e419 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -448,8 +448,31 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') }) - it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T23:01:00.000Z"', () => { - expect(dateString).toEqual('2001-05-03T23:01:00.000Z') + it('parses UTC+1:59 as "2001-05-04T00:00:00.000", resulting in "2001-05-03T22:01:00.000Z"', () => { + expect(dateString).toEqual('2001-05-03T22:01:00.000Z') + }) + }) + + // 24 of 28 + describe('new Date("May 4 UTC+1:60")', () => { + beforeEach(() => { + // Until it doesn't! + // 60 is being parsed as the year here, + // UTC+1 is the timezone. + oDate = new Date('May 4 UTC+1:60') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2001-05-04T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2001-05-04T00:00:00.000Z') + }) + + it('does NOT equal "2001-05-03T22:00:00.000Z"', () => { + expect(dateString).not.toEqual('2001-05-03T22:00:00.000Z') + }) + + it('parses UTC+1:60 as "UTC+1" AND "year 60"!, resulting in "1960-05-03T23:00:00.000Z"', () => { + expect(dateString).toEqual('1960-05-03T23:00:00.000Z') }) }) }) From 04dd415f2ad581684d3071bbe39c68b8ce8c305a Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:28:56 -0500 Subject: [PATCH 04/11] df --- __tests__/Date/wtf.unit.spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index ed7e419..be0105f 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -475,4 +475,27 @@ describe('Date', () => { expect(dateString).toEqual('1960-05-03T23:00:00.000Z') }) }) + + // 25 of 28 + describe('new Date("1990 2010")', () => { + beforeEach(() => { + // No tricks here, just a plain ol' Invalid Date. + oDate = new Date('1990 2010') + dateString = oDate.toISOString() + }) + + describe('.toTimeString()', () => { + it('equals "Invalid Date"', () => { + expect(dateString).toEqual('Invalid Date') + }) + }) + + describe('.toISOString()', () => { + it('throws', () => { + expect(() => oDate.toISOString()).toThrow() + }) + }) + }) + + // 26 of 28 }) From 02c52da0d806d32ebd5136841ecb0e183eae3f19 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:32:10 -0500 Subject: [PATCH 05/11] f --- __tests__/Date/wtf.unit.spec.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index be0105f..24d6307 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -481,7 +481,7 @@ describe('Date', () => { beforeEach(() => { // No tricks here, just a plain ol' Invalid Date. oDate = new Date('1990 2010') - dateString = oDate.toISOString() + dateString = oDate.toTimeString() }) describe('.toTimeString()', () => { @@ -498,4 +498,23 @@ describe('Date', () => { }) // 26 of 28 + describe('new Date("1990 (2010)")', () => { + beforeEach(() => { + // For some reason, parenthesised text is ignored. + oDate = new Date('1990 (2010)') + dateString = oDate.toISOString() + }) + + it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + }) + + it('does NOT equal "2010-01-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2010-01-01T00:00:00.000Z') + }) + + xit('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000Z"', () => { + expect(dateString).toEqual('1990-01-01T00:00:00.000Z') + }) + }) }) From 860b51d471bbaf813b63bbbbb447ad29ac4efe0f Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:33:34 -0500 Subject: [PATCH 06/11] fff --- __tests__/Date/wtf.unit.spec.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 24d6307..5b0bc68 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -517,4 +517,25 @@ describe('Date', () => { expect(dateString).toEqual('1990-01-01T00:00:00.000Z') }) }) + + // 27 of 28 + describe('new Date("(1990) 2010")', () => { + beforeEach(() => { + // No matter where it is. + oDate = new Date('(1990) 2010') + dateString = oDate.toISOString() + }) + + it('does NOT equal "1990-01-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('1990-01-01T00:00:00.000Z') + }) + + it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + }) + + xit('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000Z"', () => { + expect(dateString).toEqual('2010-01-01T00:00:00.000Z') + }) + }) }) From a153f5a7bd8ef1baef3158346a0354585a094e13 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:41:26 -0500 Subject: [PATCH 07/11] f --- __tests__/Date/wtf.unit.spec.js | 43 +++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 5b0bc68..63eaaf1 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -1,6 +1,7 @@ // SRC: https://jsdate.wtf/ describe('Date', () => { let oDate, dateString, dateValue, milliseconds + const _ = require('lodash') // 1 of 28 describe('new Date("0")', () => { @@ -15,7 +16,7 @@ describe('Date', () => { // FIXME? it matches in CI, but not in my local. // Is it because I am on GMT-6? - xit('interprets "0" as the year 2000, not as a timestamp!', () => { + xit('interprets "0" as the year 2000, not as a timestamp! parsing it as "2000-01-01T06:00:00.000"', () => { // The string "0" is interpreted as the year 2000, not as a timestamp! expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') // According to https://jsdate.wtf expect(dateString).toEqual('2000-01-01T06:00:00.000Z') @@ -77,6 +78,10 @@ describe('Date', () => { expect(dateValue).toBeNaN() }) + it('is still _.isDate() tho', () => { + expect(_.isDate(oDate)).toBe(true) + }) + // 5 of 28 describe('.getTime()', () => { beforeEach(() => { @@ -146,7 +151,7 @@ describe('Date', () => { // FIXME? it matches in CI, but not in my local. // Is it because I am on GMT-6? - xit('equals to "2001-01-01T00:00:00.000Z"', () => { + xit('equals to "2001-01-01T00:00:00.000"', () => { // Unlike "0", "1" is interpreted as a month, // and the year defaults to 2001 for some reason. expect(dateString).toEqual('2001-01-01T00:00:00.000Z') @@ -168,7 +173,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-02T00:00:00.000Z') }) - xit('equals "2001-02-01T00:00:00.000Z"', () => { + xit('equals "2001-02-01T00:00:00.000"', () => { expect(dateString).toEqual('2001-02-01T00:00:00.000Z') }) }) @@ -188,7 +193,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-12T00:00:00.000Z') }) - xit('equals "2001-12-01T00:00:00.000Z"', () => { + xit('equals "2001-12-01T00:00:00.000"', () => { // Also works for December. expect(dateString).toEqual('2001-12-01T00:00:00.000Z') }) @@ -257,7 +262,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2012-01-01T00:00:00.000Z') }) - xit('equals "2001-12-01T00:00:00.000Z"', () => { + xit('equals "2001-12-01T00:00:00.000"', () => { // "12.1" is interpreted as the date December 1st, // and as before for dates with no year the default is 2001 because of course. expect(dateString).toEqual('2001-12-01T00:00:00.000Z') @@ -299,7 +304,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') }) - xit('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000Z"', () => { + xit('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { // The dash here is ignored, so this is interpreted the same as "12.1". expect(dateString).toEqual('2001-12-01T00:00:00.000Z') }) @@ -316,7 +321,7 @@ describe('Date', () => { expect(dateString).not.toEqual('1970-01-01T00:00:01.000Z') }) - xit('ignores leading text. Finding "1" and parsing it as January. Resulting in "2001-01-01T00:00:00.000Z"', () => { + xit('ignores leading text. Finding "1" and parsing it as January. Resulting in "2001-01-01T00:00:00.000"', () => { // Leading text is always ignored! // It finds the "1" and parses it as the month January. expect(dateString).toEqual('2001-01-01T00:00:00.000Z') @@ -365,7 +370,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') }) - xit('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000Z"', () => { + xit('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { expect(dateString).toEqual('2001-05-01T00:00:00.000Z') }) }) @@ -513,7 +518,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2010-01-01T00:00:00.000Z') }) - xit('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000Z"', () => { + xit('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000"', () => { expect(dateString).toEqual('1990-01-01T00:00:00.000Z') }) }) @@ -534,8 +539,26 @@ describe('Date', () => { expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') }) - xit('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000Z"', () => { + xit('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000"', () => { expect(dateString).toEqual('2010-01-01T00:00:00.000Z') }) }) + + // 28 of 28 + describe('new Date(-[])', () => { + beforeEach(() => { + // -[] is coerced to 0, + // which is interpreted as milliseconds since the Unix epoch (Jan 1, 1970). + oDate = new Date(-[]) + dateString = oDate.toISOString() + }) + + it('does NOT equal "2000-01-01T00:00:00.000Z"', () => { + expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') + }) + + it('coerces -[] as 0, parsing it to "1970-01-01T00:00:00.000Z"', () => { + expect(dateString).toEqual('1970-01-01T00:00:00.000Z') + }) + }) }) From 93642db9f5aea55b882e76c9cdf268caaf96acfb Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:46:07 -0500 Subject: [PATCH 08/11] d --- __tests__/Date/wtf.unit.spec.js | 71 ++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index 63eaaf1..bf81f60 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -14,12 +14,11 @@ describe('Date', () => { expect(dateString).not.toEqual('1970-01-01T00:00:00.000Z') }) - // FIXME? it matches in CI, but not in my local. - // Is it because I am on GMT-6? - xit('interprets "0" as the year 2000, not as a timestamp! parsing it as "2000-01-01T06:00:00.000"', () => { + it('interprets "0" as the year 2000, not as a timestamp! parsing it as "2000-01-01T06:00:00.000"', () => { // The string "0" is interpreted as the year 2000, not as a timestamp! - expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') // According to https://jsdate.wtf - expect(dateString).toEqual('2000-01-01T06:00:00.000Z') + // expect(dateString).toEqual('2000-01-01T06:00:00.000Z') + const expectedDate = new Date('2000-01-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -149,12 +148,12 @@ describe('Date', () => { expect(dateString).not.toEqual('0001-01-01T00:00:00.000Z') }) - // FIXME? it matches in CI, but not in my local. - // Is it because I am on GMT-6? - xit('equals to "2001-01-01T00:00:00.000"', () => { + it('equals to "2001-01-01T00:00:00.000"', () => { // Unlike "0", "1" is interpreted as a month, // and the year defaults to 2001 for some reason. - expect(dateString).toEqual('2001-01-01T00:00:00.000Z') + // expect(dateString).toEqual('2001-01-01T00:00:00.000Z') + const expectedDate = new Date('2001-01-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -173,8 +172,10 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-02T00:00:00.000Z') }) - xit('equals "2001-02-01T00:00:00.000"', () => { - expect(dateString).toEqual('2001-02-01T00:00:00.000Z') + it('equals "2001-02-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2001-02-01T00:00:00.000Z') + const expectedDate = new Date('2001-02-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -193,9 +194,11 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-12T00:00:00.000Z') }) - xit('equals "2001-12-01T00:00:00.000"', () => { + it('equals "2001-12-01T00:00:00.000"', () => { // Also works for December. - expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -262,10 +265,12 @@ describe('Date', () => { expect(dateString).not.toEqual('2012-01-01T00:00:00.000Z') }) - xit('equals "2001-12-01T00:00:00.000"', () => { + it('equals "2001-12-01T00:00:00.000"', () => { // "12.1" is interpreted as the date December 1st, // and as before for dates with no year the default is 2001 because of course. - expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -304,9 +309,11 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') }) - xit('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { + it('ignores the "-", interpreting it like "12.1", resulting in "2001-12-01T00:00:00.000"', () => { // The dash here is ignored, so this is interpreted the same as "12.1". - expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + // expect(dateString).toEqual('2001-12-01T00:00:00.000Z') + const expectedDate = new Date('2001-12-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -321,10 +328,12 @@ describe('Date', () => { expect(dateString).not.toEqual('1970-01-01T00:00:01.000Z') }) - xit('ignores leading text. Finding "1" and parsing it as January. Resulting in "2001-01-01T00:00:00.000"', () => { + it('ignores leading text. Finding "1" and parsing it as January. Resulting in "2001-01-01T00:00:00.000"', () => { // Leading text is always ignored! // It finds the "1" and parses it as the month January. - expect(dateString).toEqual('2001-01-01T00:00:00.000Z') + // expect(dateString).toEqual('2001-01-01T00:00:00.000Z') + const expectedDate = new Date('2001-01-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -370,8 +379,10 @@ describe('Date', () => { expect(dateString).not.toEqual('2001-01-01T00:00:00.000Z') }) - xit('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { - expect(dateString).toEqual('2001-05-01T00:00:00.000Z') + it('parses "maybe" as "may"! resulting in "2001-05-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2001-05-01T00:00:00.000Z') + const expectedDate = new Date('2001-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -393,8 +404,10 @@ describe('Date', () => { expect(dateString).not.toEqual('2010-05-04T00:00:00.000Z') }) - xit('parses "may 2010" as "2010-05-01T00:00:00.000Z", ignoring "fourth of"', () => { - expect(dateString).toEqual('2010-05-01T00:00:00.000Z') + it('parses "may 2010" as "2010-05-01T00:00:00.000Z", ignoring "fourth of"', () => { + // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') + const expectedDate = new Date('2010-05-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -518,8 +531,10 @@ describe('Date', () => { expect(dateString).not.toEqual('2010-01-01T00:00:00.000Z') }) - xit('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000"', () => { - expect(dateString).toEqual('1990-01-01T00:00:00.000Z') + it('ignores text in parentheses, parsing this as "1990", resulting in "1990-01-01T00:00:00.000"', () => { + // expect(dateString).toEqual('1990-01-01T00:00:00.000Z') + const expectedDate = new Date('1990-01-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) @@ -539,8 +554,10 @@ describe('Date', () => { expect(dateString).not.toEqual('2000-01-01T00:00:00.000Z') }) - xit('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000"', () => { - expect(dateString).toEqual('2010-01-01T00:00:00.000Z') + it('ignores text in parentheses, parsing this as "2010", resulting in "2010-01-01T00:00:00.000"', () => { + // expect(dateString).toEqual('2010-01-01T00:00:00.000Z') + const expectedDate = new Date('2010-01-01T00:00:00.000') + expect(oDate.getTime()).toEqual(expectedDate.getTime()) }) }) From a80dd887a9f976b56c5a83bc6e8d72daf46c8054 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:51:55 -0500 Subject: [PATCH 09/11] f --- __tests__/Date/wtf.unit.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index bf81f60..e6c2398 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -396,7 +396,8 @@ describe('Date', () => { dateString = oDate.toISOString() }) - it('does NOT equal "2010-05-01T00:00:00.000Z"', () => { + // Works only in non-UTC timezones. + xit('does NOT equal "2010-05-01T00:00:00.000Z"', () => { expect(dateString).not.toEqual('2010-05-01T00:00:00.000Z') }) @@ -404,7 +405,7 @@ describe('Date', () => { expect(dateString).not.toEqual('2010-05-04T00:00:00.000Z') }) - it('parses "may 2010" as "2010-05-01T00:00:00.000Z", ignoring "fourth of"', () => { + it('ignores "fourth of", parsing "may 2010" as "2010-05-01T00:00:00.000"', () => { // expect(dateString).toEqual('2010-05-01T00:00:00.000Z') const expectedDate = new Date('2010-05-01T00:00:00.000') expect(oDate.getTime()).toEqual(expectedDate.getTime()) From fded93b5dbf4a735744bf9769dad9123d293bea7 Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 10:56:35 -0500 Subject: [PATCH 10/11] ff --- __tests__/nothing/undefined.unit.spec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/nothing/undefined.unit.spec.js b/__tests__/nothing/undefined.unit.spec.js index 83c4b3a..27a594d 100644 --- a/__tests__/nothing/undefined.unit.spec.js +++ b/__tests__/nothing/undefined.unit.spec.js @@ -1,13 +1,15 @@ describe('undefined', () => { 'use strict' - it("is typeof 'undefined", () => { + it("is typeof 'undefined'", () => { expect(typeof (undefined)).toEqual('undefined') }) describe('Number', () => { - it('isNaN', () => { - expect(isNaN(undefined)).toBe(true) + describe('isNaN(undefined)', () => { + it('is', () => { + expect(isNaN(undefined)).toBe(true) + }) }) }) From fa98e9519313237bd046485076527963c31f68ef Mon Sep 17 00:00:00 2001 From: JCGuerrero Date: Sat, 4 Oct 2025 11:00:23 -0500 Subject: [PATCH 11/11] fff --- __tests__/Date/wtf.unit.spec.js | 3 ++- __tests__/NaN/NaN.unit.spec.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/__tests__/Date/wtf.unit.spec.js b/__tests__/Date/wtf.unit.spec.js index e6c2398..0d7625b 100644 --- a/__tests__/Date/wtf.unit.spec.js +++ b/__tests__/Date/wtf.unit.spec.js @@ -1,7 +1,8 @@ // SRC: https://jsdate.wtf/ describe('Date', () => { + 'use strict' + let oDate, dateString, dateValue, milliseconds - const _ = require('lodash') // 1 of 28 describe('new Date("0")', () => { diff --git a/__tests__/NaN/NaN.unit.spec.js b/__tests__/NaN/NaN.unit.spec.js index 82f3a86..d485748 100644 --- a/__tests__/NaN/NaN.unit.spec.js +++ b/__tests__/NaN/NaN.unit.spec.js @@ -8,7 +8,7 @@ describe('NaN', () => { // except it("is typeof 'number'", () => { - expect(typeof (NaN)).toBe('number') // [N]ot[a][N]umber >is< a number o.0 + expect(typeof (NaN)).toBe('number') // [N]ot[a][N]umber >is< ALSO a number o.0 }) })