I’m extremely confused by the ion-datetime documentation. I’ve got some question which i hope someone can answer.
Global settings. I would like to provide translations for months etc. but right now i have to give an array of names to every ion-datetime i’m using.
ngModel. I’m not sure if i have to use ngModel or value to get the date from the datepicker. Also not sure where value is for.
The value thats returned is an object containing day, month, year etc but the docs say it returns a iso string
I use pickerOptions (which the docs dont even exist) too handle the done button but this causes the date to not be set after selecting so i have to provide a manual tick event. really weird.
Really stuck here so any help will be appreciated.
and the ngModel will be a default Javascript Date Object. The same Object that you get when you create “new Date()”.
There is a possibility that i remember this wrong and you get an ISOString, but the Date() constructor is pretty good, you just can create a new Date(timeInformation) from alomst every string or int formatted datetime / time.
Hint: just use a lot of console outputs if you don’t know what an Object is or what it does. It is very helpful to just look at the ngModels in console
Thanks for the response. The docs explicitly state not to use js date objects cause their difficult to work with etc. stating their ISO formatted thing is better. The object i get from console.log is an object with day, month, year object each containing some more values.
Could you please help me out some more. When i put the results from the ion-datetime picker in new Date() i get an invalid date. This is the object i get when i console.log the ngModel value.
I cant seem to do anything with this object its very weird