Skip to content

Commit

Permalink
always use Hong Kong time when showing times
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Mar 28, 2022
1 parent f9e0e11 commit 862048f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ declare global {
}


function pad(number : number) : string {
if (number < 10) {
return `0${number}`;
}
return String(number);
}

Date.prototype.hhmm = function () {
return `${pad(this.getHours())}:${pad(this.getMinutes())}`;
return this.toLocaleString(
[]
, {timeZone : 'Asia/Hong_Kong', hour : "2-digit", minute : "2-digit"}
);
//`${pad(this.getHours())}:${pad(this.getMinutes())}`;
};

Date.prototype.hhmmss = function () {
return `${pad(this.getHours())}:${pad(this.getMinutes())}:${pad(this.getSeconds())}`;
return this.toLocaleString(
[]
, {timeZone : 'Asia/Hong_Kong', hour : "2-digit", minute : "2-digit", second : "2-digit"}
);
};

$(document).ready(
Expand Down

0 comments on commit 862048f

Please sign in to comment.