Putting a start time in Input date

Asked

Viewed 465 times

2

Good afternoon, could you start the input date field with the time already filled ? in case I wanted to start with 23:59 and the date field to start same normal. Thank you

  • According to what is stated in documentation, the value of a field datetime-local should always have the date and time, then either you arrow everything (as in the @hugocsl answer below) or leave all fields empty. There does not seem to be a way to partially fill in (date only or only time). If that’s what you want, the way is to have two separate fields (one for date, one for time)

  • Israel, put the code in the question. Perhaps seeing the code will be easier to help.

1 answer

3


  • I’ve tried this way here and it won’t, it may be because I’m doing on Ionic ?

  • @Israelgomes Yes, because this format is not completely crossbrowser, in IE for example it doesn’t work, in mobile browsers the reference I have is the one I edited in the reply with the link. I can’t tell if it’s some compilation problem or something in Ionic.... just searching to find out

  • @Israelgomes try to put the sound date o T in this format to see if 1986-01-28 11:38:00.010

  • It does not pass, it must be something of the Ionic same

  • Hugo, and if I wanted to start with the current date and leave a standard time, I would have ?

  • @Israelgomes guy I believe it is good, but you would have to use some script to take the device date and put inside the input value, and the time will be fixed, it would be something like value=" {{dia}}+'T23:59' " type that there. Except that I don’t know anything about JS, but if you ask a new question with the code and asking how to put only the initial part with the date of the day someone will know how to help you, in fact maybe it will be duplicated rss, a searched on the site, if not find opens a new question ;)

  • Hugo, thanks man, I decided to put the time separate from the date, so if the user does not type anything the time starts at 23:59, if he type it takes the entered value, Thanks for the help. Hug!

  • @Israelgomes is a valid option, it does not greatly impact the user and you have a better control of the fields. Good luck with the project []’s

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.