Skip to content

Commit

Permalink
🐛(Date): Fixed locale in PickerDate class
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieustan committed Jun 9, 2020
1 parent a19431c commit 3a3e712
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"dist/vue-datepicker.min.js": {
"bundled": 140743,
"minified": 80246,
"gzipped": 20705
"bundled": 140715,
"minified": 80242,
"gzipped": 20709
},
"dist/vue-datepicker.esm.js": {
"bundled": 140729,
"minified": 86524,
"gzipped": 21832,
"bundled": 140701,
"minified": 86496,
"gzipped": 21835,
"treeshaked": {
"rollup": {
"code": 80064,
"code": 80060,
"import_statements": 144
},
"webpack": {
"code": 81193
"code": 81197
}
}
},
"dist/vue-datepicker.umd.js": {
"bundled": 149880,
"minified": 80543,
"gzipped": 20826
"bundled": 149852,
"minified": 80539,
"gzipped": 20830
}
}
2 changes: 1 addition & 1 deletion dist/vue-datepicker.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-datepicker.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-datepicker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-datepicker.umd.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/utils/Dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dayjs.extend(weekOfYear);
export default class PickerDate {
constructor (month, year, { lang = en } = {}) {
dayjs.locale(lang);
this.start = generateDate().year(year).month(month).startOf('month');
this.start = dayjs().year(year).month(month).startOf('month');
this.end = this.start.endOf('month');
this.month = month;
this.year = year;
Expand All @@ -43,12 +43,12 @@ export default class PickerDate {
return Array.from(generateDateRange(this.start, this.end));
}
getMonths () {
return Array.apply(0, Array(12)).map((_, i) => generateDate().month(i).format('MMM'));
return Array.apply(0, Array(12)).map((_, i) => dayjs().month(i).format('MMM'));
}
getQuarters () {
return Array.apply(0, Array(4)).map((_, i) => {
const quarterMonthStart = generateDate().quarter(i + 1).startOf('quarter').format('MMMM');
const quarterMonthEnd = generateDate().quarter(i + 1).endOf('quarter').format('MMMM');
const quarterMonthStart = dayjs().quarter(i + 1).startOf('quarter').format('MMMM');
const quarterMonthEnd = dayjs().quarter(i + 1).endOf('quarter').format('MMMM');
return `${quarterMonthStart} - ${quarterMonthEnd}`;
});
}
Expand Down

0 comments on commit 3a3e712

Please sign in to comment.