mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 23:31:24 -05:00
datetime: timezone fix in toIMF (denoland/deno_std#400)
Original: 49ae9439f7
This commit is contained in:
parent
e454934326
commit
9c852cdfd2
2 changed files with 10 additions and 1 deletions
|
@ -140,7 +140,7 @@ export function toIMF(date: Date): string {
|
||||||
"Nov",
|
"Nov",
|
||||||
"Dec"
|
"Dec"
|
||||||
];
|
];
|
||||||
return `${days[date.getDay()]}, ${d} ${
|
return `${days[date.getUTCDay()]}, ${d} ${
|
||||||
months[date.getUTCMonth()]
|
months[date.getUTCMonth()]
|
||||||
} ${y} ${h}:${min}:${s} GMT`;
|
} ${y} ${h}:${min}:${s} GMT`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,3 +83,12 @@ test({
|
||||||
assertEquals(actual, expected);
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue