287 comments found.
-
I love this Date Range Picker, The only problem is that it causes conflicts with Wordpress JS`s in some cases. Would it be too much to ask for a version compatible with Wordpress?
Sorry, my English is horrible
I won’t have time to check that until next week, can you tell me what’s not working when you use this in wordpress?
HI, About the problem with Wordpress
Look at these two directions, one has a normal datepicker and the other Caleran.
Normal datepicker : http://beta2.baobabsuites.com/suites/luxury-penthouse/indulgence/ With caleran: http://beta2.baobabsuites.com/en/suites-luxury-hotel-tenerife/luxury-penthouse/indulgence/ and check the console.
Gracias!
Hi, can you try loading momentjs and caleran.min.js into the head section of your document?
Done! Caleran.min.js and moment.min.js put on HEAD in every site
There’s a problem on the page, it can’t find caleran.. I suppose there’s a problem with something else. Can you remove the second jQuery just before the caleran initialization script?
deleted
Greetings,
I was wondering if there is a way to set the display year and month when the datepicker is opened. For example, right now I have minDate set to 2015 and maxDate set to 2016, however when I open the datepicker it is set to the current date – 2017, November. Thanks!
Hi, you can set the startDate and endDate to whatever you want to be initially selected. Or you can set caleran.globals.currentDate to set the initial month.
I am using the singleDate option for the datepicker
Ok you can use startDate then.
this is plugin for html or wordpress?
Hi sterotondo, it is for html. How do you think it can be used for wordpress? I might prepare one.
it is good for me
Hello tpasku,
I have downloaded most recent version after several updates and I have one old problem again, plus one problem i noticed that was always there.
1. Problem that happens again: I have set caleran for my input filed that opens when clicked on right button not the field itself, when I open it calendar opens but when I click another button it’s opens another calendar without closing previous one. https://www.dropbox.com/s/2g5x2ivp6944x2z/caleran_problem1.jpg?dl=02. Second problem is that caleran doesn’t pickup initial value of input field. Date formats are set correctly. So if I set date value via calendar it rembers that it has value and what value it is, but if I type manually date value or via server side code that ends up as <input … value=”some_value”> and then open calendar it does not pickup my date value and deletes it from the input field, prior versions would behave the same except it would not delete my value.
Latest version also deletes any date value upon first JS initialization of caleran. This is problem because sometimes I have default date values set from server side and then caleran init deletes them all.
Could you please look into it. Thank you very much!
It seems that if I set startEmpty:false it works, but then it writes current date to any empty input field, what I need is, if my input field has no value (initially or someone deleted it) leave it like that, if my field has value (regardless of how that value got there) pick it up. I hope this can be done.
Hi Toshier, I’ve already fixed the 2nd and 3rd one but can you prepare me a demo page related to the 1st problem?
Thanks, here is demo page: https://www.dropbox.com/s/7fynurez2y0fc0v/Demo.rar?raw=1 . Don’t mind the missing icons, I just “save as” from browser.
I can’t access to dropbox right now. Can you send me using google drive or email? my username @gmail.com.
Please don’t share urls here. Send it to my email. You can send it via my profile contact box. Delete the file you shared. BTW, the file can’t be opened.
Last update fixed all issues and added new features I needed. Thank you very much!
You’re welcome 
Hi,
I have a problem selecting ranges in the current month; I can not correctly select the start and end days.
For example, if I click on November 7 and then on November 18, it will be selected from 6 to 17. This only happens for the current month (November), if I do the same for the following month (December) it is selected correctly from 7 to 18.
In addition, the ‘caleran-start’ and ‘caleran-end’ classes are not correctly applied.
Thanks for your attention. I hope you can give me some solution to this problem.
regards
Hello again, I see that the previous user has posted the same incidence as me, sorry I have not noticed. Note: I have the same time zone: London, UK
Hi mercaservi, that’s probably a DST switch issue which I’m currently working on to solve. I’ll release an update when I complete the fix.
Hi mercaservi,
I pushed a fix today, when it get’s approved, you’ll get a notification about it. You can download and test it after that. I hope it solves the DST issues, it passed all the automated tests, but there might be some missing cases. If you encounter one, please let me know.
Hello tpaksu, It seems that the fix has solved the problem, now it works perfectly. Thank you!
You’re welcome. And thanks for letting me know.
Hi there,
I’ve just purchased this item – but noticed that when selecting a date (tomorrow for example) it actually selects a day behind (02) rather than 03. Could you look into this? Seems to be a bug on your part. The same issue is replicated on your website.
Thank you.
Hi TWDS2011, what is your timezone?
Hi tpaksu,
Timezone: London, UK.
Thank you.
Hi TWDS2011, that’s probably a DST switch issue which I’m currently working on to solve. I’ll release an update when I complete the fix.
That’s great thank you – I shall await your next release then update. Do you have an estimated time for that fix? Thanks.
I found a way to solve this, but it requires moment-timezone https://momentjs.com/timezone/ to be included and then running moment.tz.setDefault('UTC'); before creating calendars. If you want a fast solution, you can use this.
But I’m looking for an inclusive solution. I can’t give an estimate because it’s a problem related to momentjs or javascript date handling by browser javascript engines.
Hi TWDS2011,
I pushed a fix today, when it get’s approved, you’ll get a notification about it. You can download and test it after that. I hope it solves the DST issues, it passed all the automated tests, but there might be some missing cases. If you encounter one, please let me know.
HI tpaksu,
Yes I just downloaded your updated fix – and all is working fine now with no issues. Thank you for your help on this matter!
Much appreciated & great project. Thank you.
You’re welcome. Thank you for using it.
Hey tpaksu,
it looks like my calendar-implementation slowly comes to an end. Slow but steady 
I have a question: I need to hide the days of the previous and next month which are displayed with the classes .caleran-disabled together with .caleran-day. So I know that i can hide this days with opacity: 0, to prevent collapsing other days. This works, but since the latest release, it looks like, there is a bug with the classes: https://imgur.com/a/pnklC
If my report is unclear or you need further information about this issue, i will find a way to send the code to you.
Hi trick17media,
Can you prepare a demo page for me? I’ll look into that.
Hey tpaksu, here your go: http://lp.simonknoll.com/use-cases/request-minimalistic.html
Hi trick17media,
I’ll try to explain the classes:
- .caleran-day.caleran-disabled classes are used for specifying clickable disabled dates, such as enabled days that don’t belong to the current calendar month.
- .caleran-day are usual clickable days that belong to the current month.
- .caleran-disabled means disabled dates such as before than minDate or after than maxDate.
- .caleran-disabled-range means the days are disabled by array or callback function when initializing.
So you can use this CSS definitions:
.caleran-day {
visibility: visible !important;
}
.caleran-disabled {
visibility: hidden;
}
Hi tpaksu,
your suggested code does not solve my needs of hiding the days of the previous and next month in my current month. You hide all days which are disabled and not in the past, so today the 1st of November will be hidden.
Can you explain what you want to achieve again please, I might have understand your goal wrong. I thought you want to hide the days that doesn’t belong to that month, but I guess, you want to create a available window of dates to the user, and hide all the other days. You can use the disableDays method to create that window and then hide the days with the class ”.caleran-disabled-range”.
You understood my needs right! I want to hide the days that don’t belong to the month. For example the month November has 30. and 31 Oktober and first and second Dezember shown, whicht i want do hide
Normally, the code I provided would solve your problem, but you are having issues by using minDate and maxDate, try using disabledDays to disable the dates before minDate, and then use the ”.caleran-day.caleran-disabled” combo class to make them hidden. I’ll prepare a demo to check if it’ll work.
Yep it doesn’t work, but there’s a solution.
1st step: on line 1121, there’s this line in addDisabledStyles method:
cellStyle += " caleran-disabled";
replace it with
cellStyle += " caleran-disabled caleran-not-in-month";
2nd step make the “else if” -> “if” surrounding that code.
3rd step replace the ”.caleran-disabled.caleran-day” css with ”.caleran-not-in-month” selector.
The last code piece will look like this:
if (cellMoment.month() != cell.closest(".caleran-calendar").data("month")) {
// 2. not the same month of the calendar
cellStyle += " caleran-disabled caleran-not-in-month";
cellStyle = cellStyle.replace("caleran-weekend", "").replace(/ /g, " ");
}
Superb
Thank you 
hello I’m interested in your calendar but you can change the Inline Calendar to a local calendar. greetings stefaan
Hi, do you mean this?
http://rettica.com/caleran/docs/readme.html#changing-localeI mean Inline calendar with the local in changed.
Yes, the same parameter also works with inline view option. There isn’t any example with that in the documentation but it works.
Do you have a documentation that allows you to do it with code.
Looking for the update history? Got a notice of an update today and I would like to see what changed. Thanks mate, love your work!
Hi you can read the changelog file or the header of the javascript file to see what changed
Hello ! I have one issue.
Idk its right, but, only in Apple devices (Mobile or i Mac) after open the datepicker, the date appears all repeated after the day 14. I have one pic about it to show you.
after i click in input >
< October 2017 > SUN MON TUE WED THU FRI SAT 24 25 26 27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
The calendar open like this /\
Help me bro !!
Thx alot!!
Hi layum, that issue was issued once before but I couldn’t reproduce that time. Do you know how to debug source code? Can you use the source code and debug the reDrawCalendars function?
Ok, when I’ve read this, https://github.com/moment/moment/issues/1994 I found out that it’s related to daylight saving time. It’s on 14 October night this year right?
Can you explain to me? 
Right. It’s on 14 october !
Ok I’ll try to fix and release an update. Thanks for making me research this issue again 
Thx bro. I waiting for this update ;D
Hi layum, I pushed an update to envato now, it’ll be available once it gets approved. Can you check my other plugins live preview’s if they also have the same problem?
Hi layum, did you download the last update? Did you have time to check that it’s fixed and not broken something else?
Hi layum,
I pushed a fix today, when it get’s approved, you’ll get a notification about it. You can download and test it after that. I hope it solves the DST issues, it passed all the automated tests, but there might be some missing cases. If you encounter one, please let me know.
Great plugin, but I do have two issues:
1: I can’t seem to set a startDate and an endDate (default date range). I tried this:
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
$("#picker").caleran({
startDate : firstDay,
endDate: date
});
and tried setting it as a value=”” in the input, and tried setting it in the data-plugin-options of the input, but nothing seems to work; it keeps having the current date selected.
2: I like to show two months at the same time, but I would like to show the current month and the previous month, instead of the current month and the next month. Is this possible?
thanks!
Hi deveknl,
1. I would do it like this:
var date = moment();
var firstDay = moment().startOf("month");
$("#picker").caleran({
startDate : firstDay,
endDate: date
});
2. You can use this:
$("#picker").caleran({
oninit: function(caleran){
caleran.globals.currentDate = moment().add(-1,month);
}
});
hi Tpaksu, thanks for the quick reply!
1: I used your method, but it still defaults to just having today selected both as startDate and endDate.
2: looks like a solid solution, but can’t get it to work.
Maybe something is interfering? Here’s my total code:
var userLanguage = navigator.language || navigator.userLanguage;
var date = moment();
var firstDay = moment().startOf("month");
$("#picker").caleran({
startDate : firstDay,
endDate: date,
startOnMonday: true,
locale: userLanguage,
dateSeparator: ' tot ',
maxDate: new Date(),
showFooter: false,
autoCloseOnSelect: true,
onafterselect: function(caleran, startDate, endDate) {
console.log(startDate.format('DD-MM-YYYY'), endDate.format('DD-MM-YYYY'));
},
oninit: function(caleran){
caleran.globals.currentDate = moment().add(-1, "month");
}
});
<input id="picker"/>
no errors in console.
I’ll test it and prepare a demo.
There seems to be an extra part which doesn’t care startDate endDate config parameters, but you can still do it in two ways:
1. way :
oninit: function (caleran) {
caleran.config.startDate = firstDay;
caleran.config.endDate = date;
caleran.updateInput(false);
}
2. way:
var userLanguage = navigator.language || navigator.userLanguage;
moment.locale(userLanguage);
var date = moment();
var firstDay = moment().startOf("month");
$("#picker").val(firstDay.format("L") + " tot " + date.format("L"));
thanks!
and for the second issue, it’s not possible I guess 
that’s a shame, but this still is the best daterange picker I’ve found by far!
Thanks for your kind comment. I appreciate it.
is there a way to get this working when the config is set to inline: true as well?
you can add “caleran.reDrawCalendars()” after updating the input.
works great, thanks!
You’re welcome.
Hey tpaksu,
is it possible to detect the last hovered day in the calendar?
In my case, i need to add border-top-right-radius and border-bottom-right-radius to the last element. Unfortunately with pure css it is not possible to detect, the last of a class, so it would be nice if there was a event which fires after every hover-action, so i can set a class, or alternatively it would be nice if the last hovered element would get a “hovered-last”-class automatically.
What you think? Thanks and greets!
You can modify the redrawcells method (actually this and addhoverclasses if you’ve downloaded the last version) to catch the first hovered element and last hovered element (it goes with a loop) and add the styles you want. If you can’t compile the code, let me know and send you the compiled version.
Thanks for the reply! I just discovered the ondraw-event, which covers my needs.
Yes that’ll work too. Have a nice day.
Thank you! I have found a bug: When you initialize the plugin with “startEmpty : true” and open the dropdown, there is today set as start- and enddate. My Configuration is: $timespan.caleran({ oneCalendarWidth : 360, showFooter : false, minDate : moment(), startEmpty : true, startOnMonday : true, container : ’.js-form-row—timespan’, inline: true, )};
Yep the header isn’t updated. The calendar shows empty but the header contains the dates. Is it the same for you too?
You can fix it by adding this line:
if(this.config.startEmpty && this.globals.firstValueSelected === false) return;
to the beginning of the updateHeader function.
Thank you! It works now! Do you think, you will implent this for the next release? 
Yep, I pushed it to codecanyon with more updates and it’s waiting for approval right now.
If you want the release earlier, send me a message via my profile contact form.
Hi,
I found the following issue: when setting the “calendarCount” to 12, in order to show 12 months, it becomes clumsy on Google Chrome on a mobile device and it breaks the UI on Samsung Internet browser. Thanks!
I didn’t see the clumsiness on google chrome but yes you’re right, samsung internet browser has some CSS issues related to flex boxes. I’ll note this and fix it on the next release. Thank you.
Hi,
I am having issues with passing initial ‘startDate’ and ‘endDate’ to a caleran instance. I tried to set them in the initialization configuration to: 1. a JS Date object 2. a momentjs Date object, but it does not work, all I get is the current date selected as the start and end date. I’ve also tried to set these dates in the ‘oninit’ callback but with no success.
Is there any functionality for setting ‘startDate’ and ‘endDate’ manually, like ‘caleran.setStartDate(date)’? Also, any thoughts on why it doesn’t work with the initial start and end date values? Thanks!
You can fill the input directly to set them (with the correct format).
Is this the only option? This approach seems really error prone.
I really think that these are some critical features to consider for future releases because getters and setters are fundamental API methods for JS editor components such as dropdowns, selects and datepickers. Your plugin is really great – it already has a nice API exposed, has great compatibility for browsers and devices, however the aforementioned are a must.
On the other hand, given the circumstances, what do ‘startDate’ and ‘endDate’ do anyway?
It’s not the only option, you need to call updateInput(false) after you set startDate and endDate. The way that I proposed is also running the validation routine on opening the dropdown and returns to empty state if it doesn’t have the required format. But it’s the easiest one.
Look at this example:
http://rettica.com/caleran/docs/readme.html#linked-single-date-pickersit sets the startDate and minDate, and then updates the input to ensure there are no difference between the input value and the configured dates.
Hi,
This question might be rather dumb but it seems like I’m missing something. How can I get the value of a caleran instance, say for example `caleran.value()` or something similar?
Hi mcbrshishov,
Nope, its a completely valid question. You can read it in three ways:
1. Reading the input value that you’ve attached the caleran instance
2. Reading caleran.config.startDate and caleran.config.endDate variables, which you can access the caleran object with $(input).data("caleran")
3. Or by filling the onafterselect event and reading from there:
$("caleraninput").caleran({
onafterselect: function(caleran, start, end){
// start and end variables are the ones selected. (momentjs object)
}
});
Using data-plugin-attributes to set minDate, It does not work
Html Code:
<input type=”text” name=”reservation[dates]” id=”reservation_dates” value=”2017-10-15 – 2017-10-16” class=”caleran” data-plugin-options=”{:maxDate=>’2017-10-18’}”>
Thanks
Hi, Can you try setting the format to “DDDD-MM-YY beneath those? And you have a typo when defining maxDate, you have a before the property name.
in the question I was wrong, it was max date, but it works now “maxDate: ‘2017-10-18’}”
Glad it worked.
Hi there, I was wondering if there was a way to use the date range picker to bind to 2 separate inputs, one for Arrival and one for Departure, but the range is made up of the 2 input values, and populates both inputs when the range is changed..
You can check the linked date pickers example in the documentation.
thanks tpaksu, I saw that, but i was hoping for a solution that worked more like the regular date “Range” picker with the blue bar showing the dates.. but instead of it populating one field with “11/20/2017 – 11/23/2017” it just split that between the 2 inputs.. With the “Linked Single Date Pickers” example once I select the first date the picker closes and a NEW picker opens.. Make sense?
Hi InControl,
Yes but where are you planning the picker to be shown? Only on the first input? Do you have any example that might demonstrate how you want the picker to operate?
Take a look at how it works on Trip Advisor. https://www.tripadvisor.ca/HotelsList-Sydney-Cheap-Hotels-zfp5193.html: You can select input for start date, OR the end date an the calender picker shows the range based on those dates..
The closest thing I could get is:
http://rettica.com/caleran/docs/single-test-3.htmlTpaksu, thanks for the sample. The end date picker was working very much how i wanted both to function so I got it working the way i had hoped with this..
$("#caleran-ex-4, #caleran-ex-5").caleran({
target: $("#caleran-ex-6"),
startEmpty: true,
minDate: moment(),
autoCloseOnSelect: true,
showFooter: false,
onfirstselect: function(caleran, start){
$("#caleran-ex-4").val(start.format(caleran.config.format));
},
onafterselect: function(caleran, start, end){
$("#caleran-ex-4").val(start.format(caleran.config.format));
$("#caleran-ex-5").val(end.format(caleran.config.format));
}
});
Also of note the “caleran.hideDropdown();” function does not appear to work on the latest versions of Firefox or Firefox Developer Edition (OSX)
c is undefined : caleran.min.js:1:21100
hidedropdown needs an event parameter to work, you can pass new Event() inside the method.