Skip to content

Commit

Permalink
Fix timezone for tab title
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecaret committed Jul 29, 2023
1 parent 1a7ec41 commit 21ac3ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/components/NewTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const widgetNullCheck = (layer, widgetType, widget) => {
}
watch(
() => [store.config.global.tabTitle.type, store.currentTime],
() => [store.config.global.tabTitle.type, store.config.global.tabTitle.timezone, store.currentTime],
() => {
setTabTitle()
}
Expand All @@ -80,7 +80,10 @@ const setTabTitle = () => {
if (store.config.global.tabTitle.type === 'custom') {
document.title = store.config.global.tabTitle.custom
} else if (store.config.global.tabTitle.type === 'datetime') {
document.title = DateTime.fromJSDate(store.currentTime).toFormat(store.config.global.tabTitle.datetime)
document.title = DateTime.fromJSDate(store.currentTime)
.setLocale(store.config.global.lang)
.setZone(store.config.global.tabTitle.timezone ? store.config.global.tabTitle.timezone : 'default')
.toFormat(store.config.global.tabTitle.datetime)
} else {
document.title = 'New Tab'
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/DigitalClockWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const getFormattedTime = computed(() => {
if (props.widget.timezone) {
tz = props.widget.timezone !== 'local' ? props.widget.timezone : 'default'
}
return DateTime.fromJSDate(store.currentTime).setZone(tz)
return DateTime.fromJSDate(store.currentTime).setLocale(store.config.global.lang).setZone(tz)
})
const getRelativeTime = computed(() => {
Expand Down

0 comments on commit 21ac3ae

Please sign in to comment.