@@ -120,10 +120,14 @@ export default {
120120 type: Array ,
121121 default : () => [],
122122 },
123+ monthTitleFormat: {
124+ type: String ,
125+ default: ' MMMM' ,
126+ },
123127 },
124128 data () {
125129 return {
126- Xdate : this .date ,
130+ localDate : this .date ,
127131 dateUnderCursor: null ,
128132 };
129133 },
@@ -146,7 +150,7 @@ export default {
146150 months () {
147151 const months = [];
148152
149- let date = dayjs (this .Xdate );
153+ let date = dayjs (this .localDate );
150154
151155 if (this .showPreviousWeeks ) {
152156 date .startOf (' Month' );
@@ -157,7 +161,7 @@ export default {
157161 const monthKey = date .format (' YYYY/MM' );
158162
159163 months .push ({
160- title: date .format (' MMMM ' ),
164+ title: date .format (this . monthTitleFormat ),
161165 date: dayjs (date),
162166 selections: this .monthSelections [monthKey],
163167 });
@@ -169,6 +173,11 @@ export default {
169173 return months;
170174 },
171175 },
176+ watch: {
177+ date (newDate ) {
178+ this .localDate = newDate;
179+ },
180+ },
172181 methods: {
173182 onHover (date ) {
174183 if (! date .isSame (this .dateUnderCursor )) {
@@ -187,12 +196,12 @@ export default {
187196 this .$emit (' selectionChange' , { date, selected });
188197 },
189198 previousPage () {
190- this .Xdate = this .Xdate .subtract (this .visibleMonths , ' Month' ).startOf (' Month' );
191- this .$emit (' previous-page' , this .Xdate );
199+ this .localDate = this .localDate .subtract (this .visibleMonths , ' Month' ).startOf (' Month' );
200+ this .$emit (' previous-page' , this .localDate );
192201 },
193202 nextPage () {
194- this .Xdate = this .Xdate .add (this .visibleMonths , ' Month' ).startOf (' Month' );
195- this .$emit (' next-page' , this .Xdate );
203+ this .localDate = this .localDate .add (this .visibleMonths , ' Month' ).startOf (' Month' );
204+ this .$emit (' next-page' , this .localDate );
196205 },
197206 },
198207};
0 commit comments