use default timezone
This commit is contained in:
@@ -5,7 +5,6 @@ import utc from 'dayjs/plugin/utc'
|
|||||||
import timezone from 'dayjs/plugin/timezone'
|
import timezone from 'dayjs/plugin/timezone'
|
||||||
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
||||||
|
|
||||||
|
|
||||||
import 'dayjs/locale/it'
|
import 'dayjs/locale/it'
|
||||||
import 'dayjs/locale/en'
|
import 'dayjs/locale/en'
|
||||||
import 'dayjs/locale/es'
|
import 'dayjs/locale/es'
|
||||||
@@ -38,10 +37,10 @@ export default ({ app, store }) => {
|
|||||||
Vue.filter('url2host', url => url.match(/^https?:\/\/(.[^/:]+)/i)[1])
|
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('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('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
|
// 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') => {
|
Vue.filter('mediaURL', (event, type, format = '.jpg') => {
|
||||||
if (event.media && event.media.length) {
|
if (event.media && event.media.length) {
|
||||||
if (type === 'alt') {
|
if (type === 'alt') {
|
||||||
@@ -55,16 +54,16 @@ export default ({ app, store }) => {
|
|||||||
return ''
|
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 => {
|
Vue.filter('recurrentDetail', event => {
|
||||||
const parent = event.parent
|
const parent = event.parent
|
||||||
const { frequency, type } = parent.recurrent
|
const { frequency, type } = parent.recurrent
|
||||||
let recurrent
|
let recurrent
|
||||||
if (frequency === '1w' || frequency === '2w') {
|
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') {
|
} 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') {
|
if (type === 'ordinal') {
|
||||||
recurrent = app.i18n.t(`event.recurrent_${frequency}_days`, { days: d })
|
recurrent = app.i18n.t(`event.recurrent_${frequency}_days`, { days: d })
|
||||||
} else {
|
} else {
|
||||||
@@ -76,8 +75,8 @@ export default ({ app, store }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Vue.filter('when', (event) => {
|
Vue.filter('when', (event) => {
|
||||||
const start = dayjs.unix(event.start_datetime).tz(instance_timezone)
|
const start = dayjs.unix(event.start_datetime).tz()
|
||||||
const end = dayjs.unix(event.end_datetime).tz(instance_timezone)
|
const end = dayjs.unix(event.end_datetime).tz()
|
||||||
|
|
||||||
// const normal = `${start.format('dddd, D MMMM (HH:mm-')}${end.format('HH:mm) ')}`
|
// const normal = `${start.format('dddd, D MMMM (HH:mm-')}${end.format('HH:mm) ')}`
|
||||||
// // recurrent event
|
// // recurrent event
|
||||||
|
|||||||
Reference in New Issue
Block a user