Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

default_date false results in default selection of today #158

Open
dgrant85 opened this issue Jan 12, 2017 · 6 comments
Open

default_date false results in default selection of today #158

dgrant85 opened this issue Jan 12, 2017 · 6 comments

Comments

@dgrant85
Copy link

Docs state that setting default_date option to false will "keep empty value until date selected"

Expected behaviour: datepicker will have no default date selection
Actual result: today's date is selected by default

Codepen: http://codepen.io/anon/pen/pRyKgX

@nazar-pc
Copy link
Owner

This behavior might not be described perfectly, it is actually used in conjunction with input element, when you want to keep input field empty until user selects date.

@dgrant85
Copy link
Author

Ah, ok. Thanks. Is there any way to have the datepicker without a default selection on load?

I can see we already have a class for pmu-today , it would be to essentially clear .pmu-selected, until a selection is made by the user.

@nazar-pc
Copy link
Owner

You can always apply custom logic for showing which dates are selected by using https://github.com/nazar-pc/PickMeUp#selectingdisabling-dates-with-custom-logic
I think it might be better to also respect default_date: false here as well, so I'll turn this into enhancement. Feel free to send a PR.

@dgrant85
Copy link
Author

Got you, i've tried setting selected: false within the render callback however this doesn't appear to be working. Disabled works to disable the current date however today's date still holds the class pmu-selected.

Am I approaching this wrong? - CP updated : http://codepen.io/anon/pen/pRyKgX

@nazar-pc
Copy link
Owner

It only worked with true and ignored false. Should be fixed in b17664a: https://codepen.io/anon/pen/Lxxvgg

@dgrant85
Copy link
Author

Thanks can see this working. I think i've misinterpreted its function as setting false within the render callback would permanently prevent selection of that date.

I think as you suggest, it may be best to respect default_date: false here, preventing a default date selection, but allowing for a selection to be made by the user.

Essentially the use-case is that there are several instances in which one would want a datepicker without any default date selected, but allowing a user to select any date from it.

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

No branches or pull requests

2 participants