Input type datetime?


#1

I know ionic got date and time input type.
but I try to use “datetime”,not work.

how can I do for the datetime input ?
thanks.


#2

Actually, Ionic doesn’t have a custom Date/Time picker. It defaults to the native OS pickers. I don’t know if anything is in the roadmap for this. Generally, using the native picker is suggested.


#3

This may help to show what’s available on mobile devices:


#4

You could try using some kind of javascript datetime-picker. I found angular-bootstrap-datetimepicker to work quite well.

Here is an example: codepen.io/ooystein/pen/edjyH


#5

Thanks @ooystein! This was very helpful. I made it into a directive. See here: https://gist.github.com/kpowerinfinity/23f2dd9d2c67b20d2416


#6

Did someone try datetime-local as input type to get a precise date (/w hours + minutes). It seems to pop the native keyboards for iOS & Android. But not sure if it’s a good idea to use this.


#7

Yes @vmust! I set datetime-local as input type and it worked for me! I can choose date, hours and minutes.


#8

Hello,

is it possible to see this code? I ask because I have tried datetime-local on my ionic app but it does not seem to set the ngModel to what is chosen. It also doesnt trigger the ngChange on the input.

Was hoping to not have to use a library for this but I cant get the datetime-local values into my model.


#9

I am also struggling to understand same question … How to datetime-local format ?

Please let me know if you have solved it!