Skip to content

Commit bccc910

Browse files
authored
Merge pull request #60 from lionel-bijaoui/LB_pikaday_invalid_date
🐛 bug: "Invalid date" message in pikaday field.
2 parents 672e656 + a45188a commit bccc910

File tree

2 files changed

+20
-57
lines changed

2 files changed

+20
-57
lines changed

dev/schema.js

+20-24
Original file line numberDiff line numberDiff line change
@@ -303,48 +303,44 @@ module.exports = {
303303
model: "dob",
304304
required: true,
305305
placeholder: "User's birth of date",
306-
min: moment("1900-01-01").toDate(),
307-
max: moment("2016-01-01").toDate(),
308-
validator: [
309-
validators.date
310-
],
306+
validator: validators.date,
311307
pikadayOptions: {
312-
bound: true,
313-
position: 'bottom left',
314-
reposition: true,
308+
// bound: true,
309+
// position: 'bottom left',
310+
// reposition: true,
315311
// container: ,
316-
format: 'YYYY-MM-DD HH:mm:ss',
312+
// format: 'YYYY-MM-DD HH:mm:ss',
317313
// formatStrict: ,
318314
// defaultDate: ,
319315
// setDefaultDate: ,
320-
firstDay: 1,
316+
// firstDay: 1,
321317
// minDate: ,
322318
// maxDate: ,
323-
disableWeekends: false,
319+
// disableWeekends: false,
324320
// disableDayFn: ,
325321
// yearRange: ,
326-
showWeekNumber: false,
327-
isRTL: false,
328-
i18n: {
329-
previousMonth : 'Previous Month',
330-
nextMonth : 'Next Month',
331-
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
332-
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
333-
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
334-
},
322+
// showWeekNumber: false,
323+
// isRTL: false,
324+
// i18n: {
325+
// previousMonth : 'Previous Month',
326+
// nextMonth : 'Next Month',
327+
// months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
328+
// weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
329+
// weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
330+
// },
335331
// yearSuffix: ,
336-
showMonthAfterYear: false,
337-
showDaysInNextAndPreviousMonths: false,
332+
// showMonthAfterYear: false,
333+
// showDaysInNextAndPreviousMonths: false,
338334
// numberOfMonths: ,
339335
// mainCalendar: ,
340-
theme: null,
336+
// theme: null,
341337
// onSelect: ,
342338
// onOpen: ,
343339
// onClose: ,
344340
// onDraw: ,
345341
},
346342
onChanged(model, newVal, oldVal, field) {
347-
model.age = moment().year() - moment(newVal).year();
343+
// model.age = moment().year() - moment(newVal).year();
348344
}
349345

350346
},{

src/fields/fieldPikaday.vue

-33
Original file line numberDiff line numberDiff line change
@@ -49,39 +49,6 @@
4949
this.picker = new window.Pikaday(defaults(this.schema.pikadayOptions || {}, {
5050
field: this.$el, // bind the datepicker to a form field
5151
// trigger: , // use a different element to trigger opening the datepicker, see [trigger example][] (default to `field`)
52-
bound: true, // automatically show/hide the datepicker on `field` focus (default `true` if `field` is set)
53-
position: "bottom left", // preferred position of the datepicker relative to the form field, e.g.: `top right`, `bottom right` **Note:** automatic adjustment may occur to avoid datepicker from being displayed outside the viewport, see [positions example][] (default to "bottom left")
54-
reposition: true, // can be set to false to not reposition datepicker within the viewport, forcing it to take the configured `position` (default: true)
55-
// container: , // DOM node to render calendar into, see [container example][] (default: undefined)
56-
format: inputFormat, // the default output format for `.toString()` and `field` value (requires [Moment.js][moment] for custom formatting)
57-
// formatStrict: , // the default flag for moment"s strict date parsing (requires [Moment.js][moment] for custom formatting)
58-
// defaultDate: , // the initial date to view when first opened
59-
// setDefaultDate: , // make the `defaultDate` the initial selected value
60-
firstDay: 1, // first day of the week (0: Sunday, 1: Monday, etc)
61-
// minDate: , // the minimum/earliest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`)
62-
// maxDate: , // the maximum/latest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`)
63-
disableWeekends: false, // disallow selection of Saturdays or Sundays
64-
// disableDayFn: , // callback function that gets passed a Date object for each day in view. Should return true to disable selection of that day.
65-
// yearRange: , // number of years either side (e.g. `10`) or array of upper/lower range (e.g. `[1900,2015]`)
66-
showWeekNumber: false, // show the ISO week number at the head of the row (default `false`)
67-
isRTL: false, // reverse the calendar for right-to-left languages
68-
i18n: {
69-
previousMonth : "Previous Month",
70-
nextMonth : "Next Month",
71-
months : ["January","February","March","April","May","June","July","August","September","October","November","December"],
72-
weekdays : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
73-
weekdaysShort : ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]
74-
}, // language defaults for month and weekday names (see internationalization below)
75-
// yearSuffix: , // additional text to append to the year in the title
76-
showMonthAfterYear: false, // render the month after year in the title (default `false`)
77-
showDaysInNextAndPreviousMonths: false, // render days of the calendar grid that fall in the next or previous months to the current month instead of rendering an empty table cell (default: false)
78-
// numberOfMonths: , // number of visible calendars
79-
// mainCalendar: , // when `numberOfMonths` is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`). Only used for the first display or when a selected date is not already visible
80-
theme: null, // define a classname that can be used as a hook for styling different themes, see [theme example][] (default `null`)
81-
// onSelect: , // callback function for when a date is selected
82-
// onOpen: , // callback function for when the picker becomes visible
83-
// onClose: , // callback function for when the picker is hidden
84-
// onDraw: , // callback function for when the picker draws a new month
8552
}));
8653
}
8754
else{

0 commit comments

Comments
 (0)