I have a form which contains a date input.
The may enter a date in the format "DD MM YYYY" e.g. "25 12 2021".
However, in the form data/model, I'd like to convert that value into a different format: "2021-12-25".
Therefore the user sees one thing on screen, but the form data contains a reformatted version. Almost like the data gets converted before it gets added to the model, but the input still shows the original format.
Also, the other way around - the form model gets updated via patchValue
or something like that, and then the format shown to the user is in the "DD MM YYYY" format.
E.g.
<!-- user has entered "25 12 2021" -->
<input value="25 12 2021" />
// it gets stored in the model as "2021-12-25"
form.value = { date: "2021-12-25" }
// form is updated form the class
form.patchValue({date: "1999-12-25"})
<!-- user see this in the put "25 12 1999" -->
<input value="25 12 1999" />
Is that possible?
I've created a blank Stackblitz to use as a playground if that's helpful.