mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Using browser local to display time format (#18734)
Ref: https://www.notion.so/ghost/Localise-formatting-of-Timezone-e12b49ed84a74dfeb4fe922514a08832
This commit is contained in:
parent
5844e5c9f1
commit
78d43a1b1e
1 changed files with 2 additions and 1 deletions
|
@ -25,7 +25,8 @@ export function resolveAsset(assetPath: string, relativeTo: string) {
|
|||
export function getLocalTime(timeZone: string) {
|
||||
const date = new Date();
|
||||
const options = {timeZone: timeZone};
|
||||
const localTime = date.toLocaleString('en-US', options);
|
||||
const userLocale = navigator.language.startsWith('en') ? navigator.language : 'en-US';
|
||||
const localTime = date.toLocaleString(userLocale, options);
|
||||
return localTime;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue