Skip to content

Commit

Permalink
datetime: timezone fix in toIMF (denoland/std#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth authored and ry committed May 13, 2019
1 parent e454934 commit 9c852cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datetime/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}
9 changes: 9 additions & 0 deletions datetime/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

0 comments on commit 9c852cd

Please sign in to comment.