Code

Discussion on Caleran - Date Range Picker

Discussion on Caleran - Date Range Picker

By
Cart 627 sales

tpaksu supports this item

Supported

This author's response time can be up to 5 business days.

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

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?

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=0

2. 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!

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

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,

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.

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, " "); }

hello I’m interested in your calendar but you can change the Inline Calendar to a local calendar. greetings stefaan

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 !! :D Thx alot!!

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!

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!

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!

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-pickers

it 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..

Tpaksu, 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.

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey