Skip to content

Commit

Permalink
fix(#3372): get localized time independent of time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
tenthe committed Dec 5, 2024
1 parent 346a70a commit 61530e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/cypress/tests/datalake/timeRangeSelectors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ function getLocalizedDateString(date: Date) {
}

function getLocalizedTimeString(date: Date) {
// date.toISOString().substr(11, 8); // idea for fix of test
return date.toLocaleTimeString().slice(0, 8);
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${hours}:${minutes}:${seconds}`;
}

function parseTimeStringToSeconds(timeString: string) {
Expand Down

0 comments on commit 61530e3

Please sign in to comment.