Skip to content

Commit 92b4003

Browse files
committed
IsTypeable, bug fixes
1 parent 4e501b2 commit 92b4003

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

src/Demo.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:change-month-function="true"
99
:is-typeable="true"
1010
:change-year-function="true"
11+
:is-date-picker="false"
1112
:is-date-range="true"
1213
:is-multiple="false"
1314
:calendars-count="2"
@@ -56,7 +57,12 @@
5657
data() {
5758
return {
5859
calendarData: {},
59-
calendarData2: {},
60+
calendarData2: {
61+
dateRange: {
62+
start: '19.4.2019',
63+
end: '25.4.2019'
64+
}
65+
},
6066
calendar: {
6167
dateRange: {
6268

src/assets/js/calendar.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ export default {
3939

4040
return new Date(date[year], date[month] - 1, date[day]);
4141
},
42+
checkValidDate(val){
43+
val = this.getDateFromFormat(val);
44+
45+
if(val != "Invalid Date"){
46+
return true;
47+
}
48+
49+
return false;
50+
},
4251
getWeeksInMonth(month, year) {
4352
let weeks = [],
4453
firstDate = new Date(year, month, 1),

src/components/FunctionalCalendar.vue

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@
220220
this.calendar.selectedDate = val;
221221
this.markChooseDays();
222222
}
223+
224+
// Typeable
225+
if(helpCalendar.checkValidDate(val) && this.fConfigs.isTypeable) {
226+
this.ChooseDate(val);
227+
}
223228
}
224229
},
225230
'input.dateRange.start': {
@@ -229,6 +234,11 @@
229234
this.calendar.dateRange.start = val;
230235
this.markChooseDays();
231236
}
237+
238+
// Typeable
239+
if(helpCalendar.checkValidDate(val) && this.fConfigs.isTypeable) {
240+
this.ChooseDate(val);
241+
}
232242
}
233243
},
234244
'input.dateRange.end': {
@@ -238,6 +248,11 @@
238248
this.calendar.dateRange.end = val;
239249
this.markChooseDays();
240250
}
251+
252+
// Typeable
253+
if(helpCalendar.checkValidDate(val) && this.fConfigs.isTypeable) {
254+
this.ChooseDate(val);
255+
}
241256
}
242257
}
243258
},
@@ -250,15 +265,6 @@
250265
helpCalendar.configs.dayNames = this.fConfigs.dayNames;
251266
helpCalendar.configs.monthNames = this.fConfigs.monthNames;
252267
253-
254-
// Sunday Start
255-
if (this.fConfigs.sundayStart) {
256-
let dayNames = this.fConfigs.dayNames;
257-
let sundayName = dayNames[dayNames.length - 1];
258-
dayNames.splice(dayNames.length - 1, 1);
259-
dayNames.unshift(sundayName);
260-
}
261-
262268
this.setCalendarData();
263269
this.listRendering();
264270
this.markChooseDays();
@@ -313,6 +319,14 @@
313319
// New Date
314320
this.calendar.currentDate = this.newCurrentDate;
315321
}
322+
323+
// Sunday Start
324+
if (this.fConfigs.sundayStart) {
325+
let dayNames = this.fConfigs.dayNames;
326+
let sundayName = dayNames[dayNames.length - 1];
327+
dayNames.splice(dayNames.length - 1, 1);
328+
dayNames.unshift(sundayName);
329+
}
316330
},
317331
listRendering() {
318332
let vm = this;

0 commit comments

Comments
 (0)