0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-02 04:38:21 -05:00

datetime: timezone fix in toIMF (denoland/deno_std#400)

Original: 49ae9439f7
This commit is contained in:
Vincent LE GOFF 2019-05-13 20:03:24 +02:00 committed by Ryan Dahl
parent e454934326
commit 9c852cdfd2
2 changed files with 10 additions and 1 deletions

View file

@ -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`;
}

View file

@ -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);
}
});