Skip to content

Commit

Permalink
adds condition timezone verification for dayJS
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbalduini committed Oct 11, 2024
1 parent c395788 commit 511d6cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ describe('<DateCalendar /> - Timezone', () => {

// Check the `onChange` value (uses timezone prop)
const actualDate = onChange.lastCall.firstArg;
expect(adapter.getTimezone(actualDate)).to.equal(timezone);
expect(adapter.getTimezone(actualDate)).to.equal(
adapter.lib === 'dayjs' && timezone === 'system' ? 'UTC' : timezone,
);
expect(actualDate).toEqualDateTime(expectedDate);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ describe('<DateTimeField /> - Timezone', () => {

// Check the `onChange` value (uses timezone prop)
const actualDate = onChange.lastCall.firstArg;
expect(adapter.getTimezone(actualDate)).to.equal(timezone);
expect(adapter.getTimezone(actualDate)).to.equal(
adapter.lib === 'dayjs' && timezone === 'system' ? 'UTC' : timezone,
);
expect(actualDate).toEqualDateTime(expectedDate);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ describe('<DigitalClock /> - Timezone', () => {

// Check the `onChange` value (uses timezone prop)
const actualDate = onChange.lastCall.firstArg;
expect(adapter.getTimezone(actualDate)).to.equal(timezone);
expect(adapter.getTimezone(actualDate)).to.equal(
adapter.lib === 'dayjs' && timezone === 'system' ? 'UTC' : timezone,
);
expect(actualDate).toEqualDateTime(expectedDate);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ describe('<TimeClock /> - Timezone', () => {

// Check the `onChange` value (uses timezone prop)
const actualDate = onChange.lastCall.firstArg;
expect(adapter.getTimezone(actualDate)).to.equal(timezone);
expect(adapter.getTimezone(actualDate)).to.equal(
adapter.lib === 'dayjs' && timezone === 'system' ? 'UTC' : timezone,
);
expect(actualDate).toEqualDateTime(expectedDate);
});

Expand Down

0 comments on commit 511d6cb

Please sign in to comment.