Fix Schedule page shows UTC instead of local timezone (#2969)
Reported in: https://community.openhab.org/t/shown-time-in-schedule-view-is-wrong/161288 https://community.openhab.org/t/schedule-page-in-mainui-off-by-one-hour-since-4-3/161307 Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>pull/2983/head
parent
75e866792a
commit
7ac9838c9e
|
@ -50,7 +50,7 @@
|
|||
<div class="timeline-item-content">
|
||||
<div class="timeline-item-inner" v-for="(occurrence, $idx) in calendar[year][month][day]" :key="$idx">
|
||||
<div class="timeline-item-time">
|
||||
{{ occurrence[0].substring(11, 16) }}
|
||||
{{ occurrence[0].toTimeString().substring(0, 5) }}
|
||||
</div>
|
||||
<div class="timeline-item-title">
|
||||
{{ occurrence[1].name }}
|
||||
|
@ -128,7 +128,7 @@ export default {
|
|||
|
||||
// map RulesExecutions per time
|
||||
this.rules.forEach((rule) => {
|
||||
occurrences.push([new Date(rule.date).toISOString(), rule.rule])
|
||||
occurrences.push([new Date(rule.date), rule.rule])
|
||||
})
|
||||
|
||||
this.$set(this, 'calendar', {})
|
||||
|
@ -139,17 +139,14 @@ export default {
|
|||
const year = day.getFullYear()
|
||||
const month = day.toLocaleString('default', { month: 'long' })
|
||||
const dayofmonth = day.toLocaleString('default', { weekday: 'short' }) + ' ' + day.getDate()
|
||||
const monthIndex = day.getMonth()
|
||||
const dayIndex = day.getDate()
|
||||
const cal = this.calendar
|
||||
if (!cal[year]) cal[year] = {}
|
||||
if (!cal[year][month]) cal[year][month] = {}
|
||||
if (!cal[year][month][dayofmonth]) cal[year][month][dayofmonth] = []
|
||||
|
||||
const dayISODate = day.toISOString().split('T')[0]
|
||||
const dayOccurrences = occurrences.filter((o) => {
|
||||
const occurrenceISODate = o[0].split('T')[0]
|
||||
return occurrenceISODate === dayISODate
|
||||
cal[year][month][dayofmonth] = occurrences.filter((o) => {
|
||||
return o[0].getFullYear() === year && o[0].getMonth() === monthIndex && o[0].getDate() === dayIndex
|
||||
})
|
||||
cal[year][month][dayofmonth] = dayOccurrences
|
||||
day.setDate(day.getDate() + 1)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue