Adding support for set_min/max() arguments supported only by jQuery.Datepicker for HTML5/mobile browsers, thought it seems none of the browsers support them right now ...

This commit is contained in:
Ralf Becker 2016-02-10 17:42:11 +00:00
parent 44c29d52db
commit 4f2ef55206

View File

@ -355,7 +355,7 @@ String: A string in the user\'s date format, or a relative date. Relative dates
{ {
if (this.is_mobile) if (this.is_mobile)
{ {
this.input_date.attr('min', _value); this.input_date.attr('min', this._relativeDate(_value));
} }
else else
{ {
@ -365,6 +365,16 @@ String: A string in the user\'s date format, or a relative date. Relative dates
this.options.min = _value; this.options.min = _value;
}, },
/**
* Convert non html5 min or max attributes described above to timestamps
*/
_relativeDate: function(_value)
{
if (typeof _value == 'string' && _value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/)) return _value;
return jQuery.datepicker._determineDate(jQuery.datepicker, _value, this.date).toJSON();
},
/** /**
* Set the maximum allowed date * Set the maximum allowed date
* *
@ -386,7 +396,7 @@ String: A string in the user\'s date format, or a relative date. Relative dates
{ {
if (this.is_mobile) if (this.is_mobile)
{ {
this.input_date.attr('max', _value); this.input_date.attr('max', this._relativeDate(_value));
} }
else else
{ {