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

Date range selector #1084

Open
moseleyi opened this issue Jun 4, 2018 · 9 comments
Open

Date range selector #1084

moseleyi opened this issue Jun 4, 2018 · 9 comments

Comments

@moseleyi
Copy link

moseleyi commented Jun 4, 2018

Hi,

I've been on a hunt for good datepicker for a while, chiefly because I wanted to stop using jQuery widget. Configuration options in pickadate are awesome but I was wondering if you're planning on building a possibility of selecting a range of dates in one datepicker?

@DanielRuf
Copy link
Collaborator

Ranges are already supported, see the API docs.

@moseleyi
Copy link
Author

moseleyi commented Jun 5, 2018

Can you point me in the right direction? I'm looking here: http://amsul.ca/pickadate.js/date and can't see any mention of range selection

@DanielRuf
Copy link
Collaborator

Search for "range" on http://amsul.ca/pickadate.js/api/

@moseleyi
Copy link
Author

moseleyi commented Jun 5, 2018

But isn't this just to disable certain dates? What I'm looking for is for example selecting May 1st, then highlighting everything from that data until I click on, for example, May 10th and it returns the range

@moseleyi moseleyi closed this as completed Jun 5, 2018
@moseleyi moseleyi reopened this Jun 5, 2018
@DanielRuf
Copy link
Collaborator

See #446

@pirco
Copy link

pirco commented Oct 8, 2018

looking at #446 I don't see an answer to the original question which I'm pursuing myself.
not looking to DISable ranges I need a (single) calendar that allows users to pick a check-in date and a check-out date, as it were.

I certainly see that #446 mentions is feature having been added but it's not clear how to enable or implement it.

@DanielRuf
Copy link
Collaborator

v4 is not yet released and there is just the separate v4 branch.

@adam-jones-net
Copy link

I'm concluding that the broad definition of a calendar picker with date range support is not what the developers of this plugin understand range to mean.

I like many others I believe understand range in the context of date pickers to mean that you can pick two dates in the same calendar and the calendar fills in the dates between those two points with colour so that the user can see a range of dates selected. Ie a calendar as you'd see on a hotel booking site where two date inputs are required.

I understand that the developers of this plugin are using the term for functionality they have created to disable a range of dates from being selected when the calendar is defined.

I've seen so many posts on github here telling people to look at other issue numbers, especially 446. Yes that talks about ranges but not in the way that I believe many people searching the library are looking for.

From what I understand, the library doesn't support picking two dates over a range and visualising that, or am I wrong? I'd love to be corrected if so.

@mikhailcodes
Copy link

mikhailcodes commented Nov 16, 2023

As of 2023, still unable to find anything on this, which is a shame because this plugin is good otherwise.

Edit:

In case anyone needs some insight on how to probably use this as a range slider, I did some implementation here.

const datePickerSettings = {
    format: 'dddd, dd mmm, yyyy',
    formatSubmit: "yyyy/mm/dd",
    hiddenName: true,
    min: +1,
    highlight: true,
};

const startPicker = startPickerElement.pickadate('picker');
const endPicker = endPickerElement.pickadate('picker');

startPicker.on('set', () => {
    const selectedDate = startPicker.get('select', 'yyyy-mm-dd');
    const [year, month, day] = selectedDate.split("-");
    endPicker.set('min', new Date(year, month - 1, day));
});

endPicker.on('set', () => {
    const selectedDate = endPicker.get('select', 'yyyy-mm-dd');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants