Bug Tracker

Modify

Ticket #1858 (closed bug: wontfix)

Opened 6 years ago

Last modified 5 years ago

$(".calendarRange").calendar({ dateFormat: 'YMD-' });

Reported by: zcm8181 Owned by: iMarc
Priority: major Milestone: 1.2.1
Component: ui Version: 1.2.1
Keywords: calendar Cc:
Blocking: Blocked by:

Description

The code is like next, if there are to date blank(state date and end date),if we set this attribute [dateFormat: 'YMD-'], then the date limit of calendar was invalidate.

For example, if the start date is 2007-10-10,then if we focus end date, the day before 2007-10-10 should invalidate, but it is validate now. I think the function of getDate should be improved!

======================

$(document).ready(function(){

$(".calendarRange").calendar({ dateFormat: 'YMD-' });

$(".calendarRange").calendar({ fieldSettings : customRange});

function customRange(input) {

return {minDate: (input.id == 'dTo' ? getDate($('#dFrom').val()) : null),

maxDate: (input.id == 'dFrom' ? getDate($('#dTo').val()) : null)};

};

function getDate(value) {

fields = value.split('/'); return (fields.length < 3

? null

: new Date(parseInt(fields[2], 10),

parseInt(fields[1], 10) - 1, parseInt(fields[0], 10)));

};

}); =====================

Change History

comment:1 Changed 6 years ago by kbwood

This function is not part of the main calendar code. It appears in the demonstration page to show how a calendar range might be implemented. It assumes that the date format is dd/mm/yyyy. Feel free to change it for your own purposes.

comment:2 Changed 6 years ago by paul

  • Owner set to iMarc

comment:3 Changed 5 years ago by kbwood

  • Status changed from new to closed
  • Resolution set to wontfix

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.