Opened 11 years ago

Closed 9 years ago

Last modified 7 years ago

#2933 closed feature (wontfix)

isMinDate, isMaxDate and isDateInRange getter functions

Reported by: grabanski Owned by:
Priority: minor Milestone: 1.6
Component: ui.datepicker Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by Scott González)

moved from ticket #2832

User proposed adding the following functions:

$(element).datepicker('isMinDate');
$(element).datepicker('isMaxDate');
$(element).datepicker('isDateInRange');

Attachments (3)

datepicker.patch (1.8 KB) - added by grabanski 11 years ago.
datepicker_rev170_enhancements.patch (1.5 KB) - added by insekticid 11 years ago.
ui.datepicker.rev930.patch (2.8 KB) - added by insekticid 11 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 11 years ago by Scott González

Description: modified (diff)

Changed 11 years ago by grabanski

Attachment: datepicker.patch added

Changed 11 years ago by insekticid

comment:2 Changed 11 years ago by insekticid

http://dev.jquery.com/ticket/2991 ;-)

attachment datepicker_rev170_enhancements.patch added

comment:3 Changed 11 years ago by kbwood

What is the purpose of these functions? As provided isMinDate returns true if there is no minimum date or the current date is greater than or equal to the minimum!

comment:4 Changed 11 years ago by paul

Version: 1.5

comment:5 Changed 11 years ago by paul

Owner: set to kbwood
Status: newassigned

comment:6 Changed 11 years ago by Jörn Zaefferer

Milestone: 1.61.7

Deferred, unclear usecase.

Changed 11 years ago by insekticid

Attachment: ui.datepicker.rev930.patch added

comment:7 Changed 11 years ago by insekticid

using examples

jQuery.validator.addMethod("dateMin",

function (value, element, param) {

if (value == ""
!param) return true;

return $(element).datepicker('isMinDate');

}, "Please enter valid date."

);

jQuery.validator.addMethod("dateMax",

function (value, element, param) {

if (value == ""
!param) return true;

return $(element).datepicker('isMaxDate');

}, "Please enter valid date."

);

jQuery.validator.addMethod("k2dateRange",

function (value, element, param) {

if (value == ""
!param) return true;

return $(element).datepicker('isDateInRange');

}, "Please enter valid date."

);

jQuery.validator.addMethod("k2date",

function(value, element, param) {

if (!param) return true; needed for validatorCondition to work

return this.optional(element)
$(element).datepicker('isValidDate');

}, "Please enter a valid date."

);

example 2 - datepicker ranges

$('d_start_from').datepicker({'minDate':$.datepicker.parseDate("yy-mm-dd", "2008-11-13"),'beforeShow':function () { return {'maxDate':$("#d_end_to").datepicker("getMinMaxRangeDate", "max")}; }}); $('d_end_to').datepicker({'maxDate':$.datepicker.parseDate("yy-mm-dd", "2010-12-31"),'beforeShow':function () { return {'minDate':$("#d_start_from").datepicker("getMinMaxRangeDate", "min")}; }});

your custom range example is not ok, when datepickers have date limits code from example function customRange(input) {

return {minDate: (input.id == "endDate" ? $("#startDate").datepicker("getDate") : null),

maxDate: (input.id == "startDate" ? $("#endDate").datepicker("getDate") : null)};

)

comment:8 Changed 11 years ago by insekticid

you can check it at http://www.invia.cz/

comment:9 Changed 11 years ago by kbwood

See the datepicker validation module at http://keith-wood.name/datepick.html.

comment:10 Changed 11 years ago by kbwood

Owner: kbwood deleted

comment:11 Changed 9 years ago by Scott González

Resolution: wontfix
Status: assignedclosed

These can be implemented as extensions.

comment:12 Changed 7 years ago by Scott González

Milestone: 1.next1.6
Note: See TracTickets for help on using tickets.