I will add some date stuff to my app soon, I think I will use <ion-datetime>.
What is the correct way to handle dates in Ionic and Ionic Storage?
I already read about date-fns in many places, which seems to be used to parse and format strings and very powerful. But what exactly do I store in Storage? An ISO string? Where and how do I format the dates I want to output? In the templates with a directive? Or after getting it from storage? What if I want to edit values and save them back?
Ok, one thing I donāt understand yet is how do I handle seperate inputs for date and time (2 ion-datetimes)?
Do I have two seperate strings or the same one, just with different formatting?
Assume we are talking about an event. It has a ātimestampā, but I want to display date and time in 2 ion-datetimes in the form for input. Logically that makes them both the same thing⦠so just one ISO string in storage but 2 inputs bound to the same variable with 2 different formats - right?
Two inputs bound to the same variable sounds like a dangerous idea. I agree with having only one value in storage, but I think I would split it into two independent controls (or ngModel bindings) for input purposes, and then have the code that sends stuff to storage combine the relevant parts of each.
Have you been burned by them or something? Iāve never heard anything negative. Granted, Iāve never heard anything positive either. But I didnāt see i18next as a controversial tool.
When using Ionic, yours should probably be preferred. That particular version I posted actually came from a non-Ionic Angular-CLI app, and I was unable to get that syntax to work with that build toolchain.