Skip to content

Commit

Permalink
Added local timezone time-since test
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-newey committed Jan 16, 2024
1 parent 5d54b15 commit 1cc84a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ describe("ZonedDateTimeComponent", () => {

it("should update correctly when updating from an implicit to explicit timezone", () => {
// because we have not set an explicit timezone, the component should default to using the implicit timezone
spectator.component.value = DateTime.fromISO(
"2020-01-01T12:10:11.123+09:30"
);
spectator.component.value = DateTime.fromISO("2020-01-01T12:10:11.123+09:30");
update();

expect(timeElement()).toHaveExactTrimmedText("2020-01-01 12:10:11");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe("TimeSince", () => {

test( "Negative Luxon Duration", Duration.fromObject({ hours: -2, minutes: -10 }), "2 hours 10 minutes ago", "2019-12-31 21:50:00.000 +09:30 Australia/Darwin", "-PT2H10M"), test( "Unbalanced Luxon Duration", Duration.fromObject({ minutes: 300, seconds: 3600 }), "6 hours from now", "2020-01-01 06:00:00.000 +09:30 Australia/Darwin", "PT6H"),

test("Local Luxon DateTime", DateTime.fromISO("2019-12-31T14:17:58.000"), "9 hours 42 minutes ago", "2019-12-31 14:17:58.000 +09:30 Australia/Darwin", "-PT9H42M2S"),

// notice how the utc date/time was localized to Australia/Darwin (the test runners timezone)
test( "UTC Luxon DateTime", DateTime.fromISO("2019-11-13T14:17:58.000Z"), "1 month 3 weeks ago", "2019-11-13 23:47:58.000 +09:30 Australia/Darwin", "-P1M2W6DT12M2S"),

Expand Down

0 comments on commit 1cc84a8

Please sign in to comment.