diff options
| author | Vincent LE GOFF <g_n_s@hotmail.fr> | 2019-05-13 20:03:24 +0200 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-13 14:03:24 -0400 |
| commit | 9c852cdfd28da06763e14dcd5b2fac1b8fd9b9bf (patch) | |
| tree | 197e549670df1251d84004575bdf0797e529b53d /datetime | |
| parent | e454934326c8b46b1438ec605a01a86230ecde7e (diff) | |
datetime: timezone fix in toIMF (denoland/deno_std#400)
Original: https://github.com/denoland/deno_std/commit/49ae9439f71228326c1328d89502e437c00928fc
Diffstat (limited to 'datetime')
| -rw-r--r-- | datetime/mod.ts | 2 | ||||
| -rw-r--r-- | datetime/test.ts | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/datetime/mod.ts b/datetime/mod.ts index 4d627fcbe..1fd3b348f 100644 --- a/datetime/mod.ts +++ b/datetime/mod.ts @@ -140,7 +140,7 @@ export function toIMF(date: Date): string { "Nov", "Dec" ]; - return `${days[date.getDay()]}, ${d} ${ + return `${days[date.getUTCDay()]}, ${d} ${ months[date.getUTCMonth()] } ${y} ${h}:${min}:${s} GMT`; } diff --git a/datetime/test.ts b/datetime/test.ts index f47914728..2c34e4fe8 100644 --- a/datetime/test.ts +++ b/datetime/test.ts @@ -83,3 +83,12 @@ test({ assertEquals(actual, expected); } }); + +test({ + name: "[DateTime] to IMF 0", + fn(): void { + const actual = datetime.toIMF(new Date(0)); + const expected = "Thus, 01 Jan 1970 00:00:00 GMT"; + assertEquals(actual, expected); + } +}); |
