Use Date-Fns locale to generate month and day labels

This commit is contained in:
Tomazed 2023-01-30 01:25:35 +01:00
parent e8d582269b
commit 41db0e3bb1
2 changed files with 5 additions and 5 deletions

View File

@ -108,7 +108,7 @@ export default {
var _date = this.$addDaysToToday(i * -1)
days.push({
dayOfWeek: this.$formatJsDate(_date, 'EEEE'),
dayOfWeekAbbr: this.$strings[`Weekday${this.$formatJsDate(_date, 'EEE')}`],
dayOfWeekAbbr: this.$formatJsDate(_date, 'EEE'),
date: this.$formatJsDate(_date, 'yyyy-MM-dd')
})
}

View File

@ -68,7 +68,7 @@ export default {
dayLabels() {
return [
{
label: this.$strings.WeekdayMon,
label: this.$formatJsDate(new Date(2023, 0, 2), 'EEE'),
style: {
transform: `translate(${-25}px, ${13}px)`,
lineHeight: '10px',
@ -76,7 +76,7 @@ export default {
}
},
{
label: this.$strings.WeekdayWed,
label: this.$formatJsDate(new Date(2023, 0, 4), 'EEE'),
style: {
transform: `translate(${-25}px, ${13 * 3}px)`,
lineHeight: '10px',
@ -84,7 +84,7 @@ export default {
}
},
{
label: this.$strings.WeekdayFri,
label: this.$formatJsDate(new Date(2023, 0, 6), 'EEE'),
style: {
transform: `translate(${-25}px, ${13 * 5}px)`,
lineHeight: '10px',
@ -208,7 +208,7 @@ export default {
const date = i === 0 ? this.firstWeekStart : this.$addDaysToDate(this.firstWeekStart, i)
const dateString = this.$formatJsDate(date, 'yyyy-MM-dd')
const datePretty = this.$formatJsDate(date, 'MMM d, yyyy')
const monthString = this.$strings[`Month${this.$formatJsDate(date, 'MMM')}`]
const monthString = this.$formatJsDate(date, 'MMM')
const value = this.daysListening[dateString] || 0
const x = col * 13
const y = row * 13