I'm using Datejs - js date library and i have a function:
var initDateRangePicker = function() {
console.log(Date.today());
$('.date-range').daterangepicker(
{
opens: (App.isRTL() ? 'left' : 'right'),
format: 'dd/MM/yyyy',
separator: ' do ',
startDate: Date.today().add({
months: -1
}),
endDate: Date.today(),
minDate: '01/01/2013',
maxDate: '31/12/2054'
}
);
console.log({a: Date.today()});
};
Daterangepicker is initialized with correct values (Date.today()
and Date.today().add({months:-1})
)
Unfortunately, in console I have in both cases RangeError. Why? Please, help.
So I just ran the DateJS part of your code (disclaimer: I maintain an active, and heavily updated, fork of DateJS)...
Doesn't seem to be any problem in the DateJS code - at least in my fork - as I'm getting zero errors created the object you pass into the picker. Perhaps it's a problem with the daterangepicker
plugin?