-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Ionic 4: DateTime - Start picker on today's date #16436
Comments
Have you tried adding an initial value to this as todays date? |
I was trying to avoid dirtying the form. I can do a work around by having a viewValue and my dataValue. The viewValue is what the date time uses whilst the dataValue updates if the OK button is pressed which now can be controlled though the custom picker options. However it’s seems a bit of work for something that logically should be available. If you look at angular material date picker which is a good comparison given it’s maturity and popularity, they have a whole section dedicated to setting the initial view. |
Yeah it's definitely not ideal, but I am just trying to find a way that you can get around it for the time being. We will let you know when it is fixed! |
Thanks for considering, look forward to the fix |
Is there any idea when this will be fixed? I’ve tried as a work around setting the today date when date is empty using the ionFocus event but still doesn’t work ie displays on max range. Is there any other work around available in the interim? |
@liamdebeasi thank you, ultimately if we can have a property that allows us to pass a start view date like today's date that would be awesome |
Hi @bkarv, You should be able to do that already. If you provide a valid ISO string to the Example:
|
@liamdebeasi Unfortunately no the issue is the value is initially null, if you set this value it will show as as the value set in the UI input not as null. Maybe I wasn't clear what I meant by start view date, I meant the value to be shown when the date selection window is open. It would be great to be able to pass the value for the dial to open on if not value is set. But hey right now I settle for it opening on the current date when the value is null. Can you just confirm in datetime mode it shows the current local time as I think there was a bug in Ionic 3 when it wouldn't open on the current time. Many thanks for the help on this.. |
@liamdebeasi Thanks Liam upgraded and looks like it is defaulting to today's time. However it seems like it defaults to GMT time not the local time. Another person has already raised an issue: |
Hi @liamdebeasi I've been using the nightly build ( "@ionic/core": "^4.1.2-dev.201903111954.bab56e8") in order to have the current date on ion-datetime but I'm still getting the wrong date/hour: Example : My code: Scenario: |
Hi @carlos2712, If you set Thanks! |
Nope, It didn't work. I tried with undefined and also like this :
Like not having values at all. But it didn't work. Any idea? Thanks! |
Interesting. The following datetimes are showing the correct date and formatted properly:
The following datetimes are not formatted properly (working on a fix for this):
None of these are working for you, correct? |
Thanks for the additional info. Could you post the contents of your |
{ |
Ah! Make sure you install the nightly |
Great, glad to hear the time is formatting correctly. I will work on a fix for the placeholder issue. |
Thanks! Will be more than happy to test when you get the PR. |
I appreciate all the testing you are doing! I pushed a new nightly build a moment ago that should resolve the placeholder issues. There were some discrepancies between the core Ionic component and Angular's |
Okay, I will test that out! Thank you for your help! |
Hi there, This has been fixed with the latest version of Ionic ( Thanks! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Feature Request
Ionic Info
Run
ionic info
from a terminal/cmd prompt and paste the output below.Describe the Bug
In DateTime when a 'max' is set, the date picker starts at at max value, which makes it a poor UI experience. It should start at current date/time or property to supply a starting point.
Steps to Reproduce
In Ionic 4 set Datetime 'max' to a large number and picker will start their.
Expected Behavior
Start at today's date or allow us to supply a starting pointl
Additional Context
.
The text was updated successfully, but these errors were encountered: