Skip to content

Commit

Permalink
Fix Schedule page shows UTC instead of local timezone (#2969)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimtng authored Jan 4, 2025
1 parent 75e8667 commit 7ac9838
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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', {})
Expand All @@ -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)
}
Expand Down

0 comments on commit 7ac9838

Please sign in to comment.