question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request : DateTime Component - Option to set current time as default value for picker

See original GitHub issue

Short description of the problem:

The DateTime Component allows to create a simple input component for date and time inputs. It would be nice, if there was an option to set the current time as default value for the picker.

In many cases it would be useful, if the default value of the picker was not 1. January 2016 but the current date of the day. With this people could fill out the form even faster, same applies to time inputs.

What behavior are you expecting?

Add some sort of attribute to the datetime component which allows to set the default value of the picker to the current time.

<ion-item>
  <ion-label>Date</ion-label>
  <ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="myDate" useCurrentTimeAsDefaultValue="true"></ion-datetime>
</ion-item>

Which Ionic Version? ionic 2.00-beta 11

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
charlesencommented, Jun 13, 2017

What if we want our input to be empty but setting picker to the current date ?

3reactions
ollyjohncommented, Jun 23, 2017

+1 on @charlesen’s comment. This is a situation I’m currently facing which doesn’t seem to be catered for…

Read more comments on GitHub >

github_iconTop Results From Across the Web

DateTime Component - Option to set current time as default ...
Short description of the problem: The DateTime Component allows to create a simple input component for date and time inputs.
Read more >
Solved: How to set current date as default date in date pi...
Another alternative, which is probably preferred, is to "Reset" the date picker control - which causes its selected date to go back to...
Read more >
Can I dynamically set default value to date picker?
Hello,. After creating a date-picker, there is an option to set the "Default Value" for it. And this is a static value.
Read more >
Default value for DateTime Picker - Inductive Automation Forum
Right-click your DateTime component. Select “Configure Events”. Select the onStartup option under System Events. Select a Script Action.
Read more >
<input type="datetime-local"> - HTML - MDN Web Docs
elements of type datetime-local create input controls that let ... You can set a default value for the input by including a date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found