Skip to main content

Search and Top Navigation

#9788 closed bug (invalid)

Opened February 04, 2014 07:39PM UTC

Closed February 19, 2014 09:02AM UTC

Date picker swapping month and day for Canada users

Reported by: gudikavitha Owned by: gudikavitha
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.4
Keywords: Cc:
Blocked by: Blocking:
Description

Hi, we are using datepicker withd efault format mm/dd/yy, for some Canada users it's flipping as dd/mm/yy. Not sure what's causing this to happen. Since they are home computers, hard to track the problem.

Code: <pre>

$(document).ready(function() {

var today = new Date(),

minutes = today.getMinutes(),

previousdate = today.getTime(),

previousdate = previousdate - (today.getHours() * 60 * 60 * 1000) - (today.getMinutes() * 60 * 1000) - (today.getSeconds() * 1000),

onejan = new Date(today.getFullYear(),0,1);

var minDate = today;

var hours = minDate.getHours();

if(minDate.getDay()>=1){

if(hours >= 7 && minutes > 0){

minDate = new Date(minDate.setDate(minDate.getDate() + 7));

}

}

Date.prototype.getWeek = function () { return $.datepicker.iso8601Week(this); }

var pickerOpts = {

showOn: "button",

buttonImage: './images/calendar.gif',

buttonImageOnly: true,

showWeek:true,

minDate: today,

beforeShowDay: function(date)

{

if(date.getWeek()>=1 && date.getWeek()<=23){

return [(date.getDay() == 4), ""];

}else{

return [false,""];

}

}

};

var cal = {

showOn: "button",

buttonImage: './images/calendar.gif',

buttonImageOnly: true

};

var minDefferalDate = new Date();

var minutesDeff = minDefferalDate.getMinutes();

var hoursDeff = minDefferalDate.getHours();

if(minDefferalDate.getDay()==5){

//if(hoursDeff >= 7 && minutesDeff > 17 ){

if(hoursDeff > 5){

minDefferalDate = new Date(minDefferalDate.setDate(minDefferalDate.getDate() + 10));

}

}

var pickerMon = {

showOn: "button",

buttonImage: './images/calendar.gif',

buttonImageOnly: true,

minDate: minDefferalDate,

beforeShowDay: function(date)

{

return [(date.getDay() == 1), ""];

}

maxDate: calendar.newDate(date.getYear()+1, 8, 1),

};

$("#date").datepicker(pickerOpts);

$("#date1").datepicker(pickerMon);

$("#date2").datepicker(pickerMon);

$("#date3").datepicker(pickerMon);

$("#date4").datepicker(pickerMon);

$("#date5").datepicker(pickerMon);

$('#datePicker').datepicker({ minDate: 4,beforeShowDay: $.datepicker.noWeekends });

$("#startDate").datepicker(cal);

$("#endDate").datepicker(cal);

$('#startDate').attr('readonly', true);

$('#endDate').attr('readonly', true);

$(".listItr td:not(:LAST-CHILD)").css({'border' :'1px solid black'});

$("table.gridtable th:not(:LAST-CHILD)").css({ 'border-width': '1px', 'padding': '8px', 'border-style': 'solid', 'border-color': '#666666',

'background-color': '#dedede'});

/*

*
  • To allow only numeric values in s:textfield
  • */

    $('#cid').keypress(function(e) {

    var a = [];

    var k = e.which;

    for (i = 48; i < 58; i++)

    a.push(i);

    if (!($.inArray(k,a)>=0))

    e.preventDefault();

    });

    });

    </pre>

    Attachments (0)
    Change History (2)

    Changed February 04, 2014 07:45PM UTC by scottgonzalez comment:1

    owner: → gudikavitha
    status: newpending

    We need a reduced test case that reliably reproduces the problem. Please read the instructions in the red box.

    Changed February 19, 2014 09:02AM UTC by trac-o-bot comment:2

    resolution: → invalid
    status: pendingclosed

    Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!