-
Notifications
You must be signed in to change notification settings - Fork 142
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
Make min date as default when calendar opens #256
Comments
|
That is ok, but what about my question? Does this make sense? I can try a PR if you want I think that is a very useful feature. |
I don't understand why dispalayDate doesn't solve your case |
Because we don’t want to display anything until the user picks a day. It doesn’t make sense to show in calendar the current date if the min date is set for later. I’ll create a stackblitz to demonstrate the behavior |
I'm trying to create a Stackblitz with moment but it does not work: https://stackblitz.com/edit/angular-trty1e It says that moment is not a function. |
try this one: https://stackblitz.com/edit/angular-1e7a7vv |
I get:
|
Ok I got it to work: https://stackblitz.com/edit/angular-trty1e Note that although the min date is december, when the picker opens it shows the current month. This does not make sense. If you check other datepickers you will see that the min is always the default date, for example: |
@dgroh, it make sense. I will implement it in the next version (2.6.0) |
Brilliant much appreciated |
resolved in 5663b7a |
Hey, Sorry to open this again but I am trying to implement this exact behaviour and have the latest version, but no joy. Below is my initialisation of the config object, setting a time of 12:30 the next day, followed by the picker instance in the view. Feel free to let me know if I'm being stupid but I can't see what I'm doing wrong? Thanks!
----- Date Picker Instance -----
|
pls provide a stackblitz |
So as I understand it, setting the min parameter of the config object to a particular date should select that date if the current date is earlier? |
Hey, just an update/clarification. The above code and the original stackblitz had the date strings formatted in such a way that there was no year present ("DD MMM [at] HH:mm"). I have updated in my code and on the stackblitz which half solves the issue in that the picker opens on the minimum date, but the time is still just set to whatever time it is when the page loads. I understand that setting the model (or control name) does cause the picker to open at a specified time, but I don't want to actually have to set the date and time on load. I just want the picker to open at the date and time that corresponds to the minDate value. Can it be done in a way that I am missing? Thanks and Happy New Year! |
Is it possible to make a default date in calendar if I set it to min?
Scenario: The current date is
10-19-2017
, but the min date that the user can select is12-01-2017
When the user opens the DatePicker, he is going to see
10-19-2017
and won't understand what is happening. This is a common feature for the most of DatePicker controls.Using
displayDate
could solve this, but thing is we don't want so show anything in the input so long the user has not picked any date.The text was updated successfully, but these errors were encountered: