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

The inputDate only works if no date was selected before #74

Closed
CheckHelzio opened this issue Jan 30, 2017 · 15 comments
Closed

The inputDate only works if no date was selected before #74

CheckHelzio opened this issue Jan 30, 2017 · 15 comments

Comments

@CheckHelzio
Copy link

Hi!
First of all thanks for the wonderful work creating this component.

The inputDate works to open the datePicker on a specific date, but after I use the datePicker to select any other date, the inputDate does not work again.

What can I do if I want to open the datePicker always on the same date, even if I already select another one?

@motss
Copy link
Owner

motss commented Jan 30, 2017

@CheckHelzio May I know what your use case is for this kind of purpose? I'd like to know a little bit more on what approach to best suit your use case. And I understand you want it to be able to reset to the given inputDate everytime the datepicker opens. Am I correct?

@CheckHelzio
Copy link
Author

I am developing an application that is a calendar of the events that will be in my university.

I use the datePicker to navigate faster to a specific date. Also as a shortcut to return to today.

I use it also to generate reports of the events, selecting the initial and final date of the report.

@sp1rs
Copy link
Contributor

sp1rs commented May 11, 2017

@motss Yes, whenever the datepicker opens, I would like to reset the inputDate.
And also I have something like this.

<app-datepicker id="picker" date="{{testDate}}"></app-datepicker>

this.$.picker.inputDate = x;
# Then testDate was set as x?

testDate was set as date which I gave in inputDate? Is this the right flow?

@motss
Copy link
Owner

motss commented May 11, 2017

@sp1rs reset inputDate or resete date?

@sp1rs
Copy link
Contributor

sp1rs commented May 11, 2017

@motss both inputDate and selectedDate.

@sp1rs
Copy link
Contributor

sp1rs commented May 11, 2017

@motss and why setting inputDate, changes data also ?

@motss
Copy link
Owner

motss commented May 11, 2017

@sp1rs inputDate will directly affect the selected date internally but that does not actually update the date which will output the selected date. Why? It's because app-datepicker usually use within a dialog and only clicking the OK button will trigger updating the value date whereas CANCEL button means you don't want to output the selected date. But for app-datepicker has another method called enforceDateChange which will update the app-datepicker (not app-datepicker-dialog).

@motss
Copy link
Owner

motss commented May 11, 2017

@sp1rs The use case to me is quite rare. The only way to do is to introduce a flag for this kind of use case.

@motss motss closed this as completed in cd8d97c May 11, 2017
@motss
Copy link
Owner

motss commented May 11, 2017

@sp1rs @CheckHelzio cd8d97c should fix this with newly added flag alwaysResetSelectedDateOnDialogClose.

@motss
Copy link
Owner

motss commented May 11, 2017

The demo always updated with this rare use case. PTAL. 👍

Updated demo with alwaysReset flag

@sp1rs
Copy link
Contributor

sp1rs commented May 15, 2017

Thanks, @motss

@sp1rs
Copy link
Contributor

sp1rs commented May 17, 2017

@motss When is the fix going live?

@motss
Copy link
Owner

motss commented May 17, 2017

@sp1rs Since the Polymer 2.0 went stable, I'm still working on maybe this can be a hybrid element for the latest stable version alongside this patch. Of course, as always, help are definitely welcomed. Stay tuned~

@motss
Copy link
Owner

motss commented May 20, 2017

@sp1rs Please check out the latest release which has been upgraded into a hybrid Polymer Element! 🌮 🎉

@sp1rs
Copy link
Contributor

sp1rs commented May 20, 2017

@motss awesome, thanks a lot.

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

3 participants