As @alliomeria and I discovered today, if your webform has actual ISO8601 dates formatted (storing in JSON) the EDTF formatter will kinda give up. This better approach (which I'm sure I coded already in the past but can't find where/how? why am I so tired all the time?) tries in case of an EDTF failure with a direct PHP string to Date approach. How?
How?
First we try assuming the date is already ISO8601 ('c' format). Why? because in the next step I will convert all into a UNIX Timestamp and as you well know Unix TimeStamps have no Time Zones (and ISO8601 has).
If this fails we check if not numeric. Why? because next step deals with all except with timestamps.
If not numeric we go with a strtotime() which will accept things like "yesterday", "tomorrow", "2022", "1917-01", etc. and will return a timestamp
If there is a timestamp we cast now back into ISO8601 and return that
If all failed we return FALSE and assume this was really never a time crystal
@aksm for your eyes too. @patdunlavey you may want to read this too
What?
As @alliomeria and I discovered today, if your webform has actual ISO8601 dates formatted (storing in JSON) the EDTF formatter will kinda give up. This better approach (which I'm sure I coded already in the past but can't find where/how? why am I so tired all the time?) tries in case of an EDTF failure with a direct PHP string to Date approach. How?
How?