use default timezone

This commit is contained in:
lesion 2022-08-05 18:08:15 +02:00
parent e0342b0dd7
commit 58c142b12b
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -5,7 +5,6 @@ import utc from 'dayjs/plugin/utc'
import timezone from 'dayjs/plugin/timezone'
import localizedFormat from 'dayjs/plugin/localizedFormat'
import 'dayjs/locale/it'
import 'dayjs/locale/en'
import 'dayjs/locale/es'
@ -38,10 +37,10 @@ export default ({ app, store }) => {
Vue.filter('url2host', url => url.match(/^https?:\/\/(.[^/:]+)/i)[1])
Vue.filter('datetime', value => dayjs.tz(value).locale(locale).format('ddd, D MMMM HH:mm'))
Vue.filter('dateFormat', (value, format) => dayjs.tz(value).format(format))
Vue.filter('unixFormat', (timestamp, format) => dayjs.unix(timestamp).tz(instance_timezone).format(format))
Vue.filter('unixFormat', (timestamp, format) => dayjs.unix(timestamp).tz().format(format))
// shown in mobile homepage
Vue.filter('day', value => dayjs.unix(value).tz(instance_timezone).locale(store.state.locale).format('dddd, D MMM'))
Vue.filter('day', value => dayjs.unix(value).tz().locale(store.state.locale).format('dddd, D MMM'))
Vue.filter('mediaURL', (event, type, format = '.jpg') => {
if (event.media && event.media.length) {
if (type === 'alt') {
@ -55,16 +54,16 @@ export default ({ app, store }) => {
return ''
})
Vue.filter('from', timestamp => dayjs.unix(timestamp).tz(instance_timezone).fromNow())
Vue.filter('from', timestamp => dayjs.unix(timestamp).tz().fromNow())
Vue.filter('recurrentDetail', event => {
const parent = event.parent
const { frequency, type } = parent.recurrent
let recurrent
if (frequency === '1w' || frequency === '2w') {
recurrent = app.i18n.t(`event.recurrent_${frequency}_days`, { days: dayjs.unix(parent.start_datetime).tz(instance_timezone).format('dddd') })
recurrent = app.i18n.t(`event.recurrent_${frequency}_days`, { days: dayjs.unix(parent.start_datetime).tz().format('dddd') })
} else if (frequency === '1m' || frequency === '2m') {
const d = type === 'ordinal' ? dayjs.unix(parent.start_datetime).date() : dayjs.unix(parent.start_datetime).tz(instance_timezone).format('dddd')
const d = type === 'ordinal' ? dayjs.unix(parent.start_datetime).date() : dayjs.unix(parent.start_datetime).tz().format('dddd')
if (type === 'ordinal') {
recurrent = app.i18n.t(`event.recurrent_${frequency}_days`, { days: d })
} else {
@ -76,8 +75,8 @@ export default ({ app, store }) => {
})
Vue.filter('when', (event) => {
const start = dayjs.unix(event.start_datetime).tz(instance_timezone)
const end = dayjs.unix(event.end_datetime).tz(instance_timezone)
const start = dayjs.unix(event.start_datetime).tz()
const end = dayjs.unix(event.end_datetime).tz()
// const normal = `${start.format('dddd, D MMMM (HH:mm-')}${end.format('HH:mm) ')}`
// // recurrent event