Skip to content

Commit b8b24ca

Browse files
committed
fix: Wrong month name when using format-locale in overridden timezone (fixes #817)
1 parent 57b20e6 commit b8b24ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/VueDatePicker/utils/util.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
import { type Locale } from 'date-fns';
1414
import type { ComponentPublicInstance } from 'vue';
1515
import { getDate } from '@/utils/date-utils';
16+
import { localToTz } from '@/utils/timezone';
1617

1718
export const getArrayInArray = <T>(list: T[], increment = 3): T[][] => {
1819
const items = [];
@@ -93,7 +94,7 @@ export const getMonths = (
9394
try {
9495
const monthDateFnsFormat = monthFormat === 'long' ? 'MMMM' : 'MMM';
9596
return months.map((date, i) => {
96-
const month = format(date, monthDateFnsFormat, { locale: formatLocale });
97+
const month = format(localToTz(date, 'UTC'), monthDateFnsFormat, { locale: formatLocale });
9798
return {
9899
text: month.charAt(0).toUpperCase() + month.substring(1),
99100
value: i,

0 commit comments

Comments
 (0)