Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add using global moment locale... #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions jquery.daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@
$(window).bind('resize.datepicker',calcPosition);

return this;

function IsOwnDatePickerClicked(evt, selfObj)
{
return ( selfObj.contains(evt.target) || evt.target == selfObj || (selfObj.childNodes != undefined && $.inArray(evt.target, selfObj.childNodes)>=0))
Expand Down Expand Up @@ -1030,10 +1030,10 @@
// set initiated to avoid triggerring datepicker-change event
initiated = false;
if(defaults.length >= 2){
setDateRange(moment(defaults[0], ___format, moment.locale(opt.language)).toDate(),moment(defaults[1], ___format, moment.locale(opt.language)).toDate());
setDateRange(moment(defaults[0], ___format).toDate(),moment(defaults[1], ___format).toDate());
}
else if(defaults.length==1 && opt.singleDate){
setSingleDate(moment(defaults[0], ___format, moment.locale(opt.language)).toDate());
setSingleDate(moment(defaults[0], ___format).toDate());
}

initiated = true;
Expand Down Expand Up @@ -1070,7 +1070,7 @@
renderTime("time2", opt.end);
}

function setTime (name, hour, minute)
function setTime (name, hour, minute)
{
hour && (box.find("." + name + " .hour-val").text(hour));
minute && (box.find("." + name + " .minute-val").text(minute));
Expand Down Expand Up @@ -1247,7 +1247,7 @@
autoclose();
}


function weekNumberClicked(weekNumberDom)
{
var thisTime = parseInt(weekNumberDom.attr('data-start-time'),10);
Expand Down Expand Up @@ -1275,13 +1275,13 @@
autoclose();
}

function isValidTime(time)
function isValidTime(time)
{
time = parseInt(time, 10);
if (opt.startDate && compare_day(time, opt.startDate) < 0) return false;
if (opt.endDate && compare_day(time, opt.endDate) > 0) return false;

if (opt.start && !opt.end && !opt.singleDate)
if (opt.start && !opt.end && !opt.singleDate)
{
//check maxDays and minDays setting
if (opt.maxDays > 0 && countDays(time, opt.start) > opt.maxDays) return false;
Expand Down Expand Up @@ -2162,6 +2162,7 @@
}
else if ( opt.language && opt.language in $.dateRangePickerLanguages)
{
moment.locale(opt.language);
return $.dateRangePickerLanguages[opt.language];
}
else
Expand Down