using timezone from server, #49 #43

This commit is contained in:
jb-alvarado 2021-03-23 13:57:30 +01:00
parent 6538f3c9da
commit ccd9e28514
3 changed files with 12 additions and 12 deletions

View File

@ -78,7 +78,7 @@ export default {
return {
logName: 'ffplayout',
currentLog: null,
listDate: this.$dayjs().format('YYYY-MM-DD'),
listDate: this.$dayjs().tz(this.timezone).format('YYYY-MM-DD'),
scrollOP: {
wheelSpeed: 5
}
@ -86,7 +86,7 @@ export default {
},
computed: {
...mapState('config', ['configID'])
...mapState('config', ['configID', 'timezone'])
},
watch: {

View File

@ -345,8 +345,8 @@ export default {
return {
isLoading: false,
isPlaying: '',
listDate: this.$dayjs().format('YYYY-MM-DD'),
targetDate: this.$dayjs().format('YYYY-MM-DD'),
listDate: this.$dayjs().tz(this.timezone).format('YYYY-MM-DD'),
targetDate: this.$dayjs().tz(this.timezone).format('YYYY-MM-DD'),
interval: null,
extensions: '',
videoOptions: {
@ -367,7 +367,7 @@ export default {
},
computed: {
...mapState('config', ['configID', 'configGui', 'configPlayout']),
...mapState('config', ['configID', 'configGui', 'configPlayout', 'timezone']),
...mapState('media', ['crumbs', 'folderTree']),
...mapState('playlist', ['timeStr', 'timeLeft', 'currentClip', 'progressValue', 'currentClipIndex', 'currentClipDuration', 'currentClipIn', 'currentClipOut']),
playlist: {
@ -412,11 +412,11 @@ export default {
this.extensions = this.configPlayout.storage.extensions.join(',')
await this.getPath(this.extensions, '')
const timeInSec = this.$timeToSeconds(this.$dayjs().format('HH:mm:ss'))
const timeInSec = this.$timeToSeconds(this.$dayjs().tz(this.timezone).format('HH:mm:ss'))
const listStartSec = this.$timeToSeconds(this.configPlayout.playlist.day_start)
if (listStartSec > timeInSec) {
this.listDate = this.$dayjs(this.listDate).subtract(1, 'day').format('YYYY-MM-DD')
this.listDate = this.$dayjs(this.listDate).tz(this.timezone).subtract(1, 'day').format('YYYY-MM-DD')
}
await this.getPlaylist()

View File

@ -52,11 +52,11 @@ export const mutations = {
export const actions = {
async getPlaylist ({ commit, dispatch, state, rootState }, { dayStart, date, configPath }) {
const timeInSec = this.$timeToSeconds(this.$dayjs().format('HH:mm:ss'))
let dateToday = this.$dayjs().format('YYYY-MM-DD')
const timeInSec = this.$timeToSeconds(this.$dayjs().tz(rootState.config.timezone).format('HH:mm:ss'))
let dateToday = this.$dayjs().tz(this.timezone).format('YYYY-MM-DD')
if (rootState.config.startInSec > timeInSec) {
dateToday = this.$dayjs(dateToday).subtract(1, 'day').format('YYYY-MM-DD')
dateToday = this.$dayjs(dateToday).tz(rootState.config.timezone).subtract(1, 'day').format('YYYY-MM-DD')
}
const response = await this.$axios.get(`api/player/playlist/?date=${date}&config_path=${configPath}`)
@ -77,7 +77,7 @@ export const actions = {
setCurrentClip ({ commit, dispatch, state, rootState }) {
let begin
let lastTime = this.$timeToSeconds(this.$dayjs().format('HH:mm:ss'))
let lastTime = this.$timeToSeconds(this.$dayjs().tz(rootState.config.timezone).format('HH:mm:ss'))
if (Number.isFinite(rootState.config.startInSec)) {
begin = rootState.config.startInSec
@ -112,7 +112,7 @@ export const actions = {
},
animClock ({ commit, dispatch, state, rootState }) {
const time = this.$dayjs().format('HH:mm:ss')
const time = this.$dayjs().tz(rootState.config.timezone).format('HH:mm:ss')
let timeSec = this.$timeToSeconds(time)
commit('SET_TIME', time)