by tdrdt · 5y ago · 0 comments
Formats for dates and money are available in almost every programming language as library. You don't have to invent this yourself. The same for timezones, as long als all dates in your DB are UTC.
And inputs for phone numbers and addresses fall in the category of 'Falsehood programmers believe about...'.
If you store your data normalized all the programming language locale libraries make your life easy.
/2c
times don't have to be UTC but need the timezone info attached - be it implicit (all are UTC) or explicit, e.g. in text form rfc3339.
Stripping the time-zone is information-loss and usually not desirable.
It doesn't tell you anything about the time zone this particular user would want to see it in today, which depends on quite a few factors including where they are and what the timestamp relates to (booking, event, log of past events etc).
then you may be fine with that information loss. But is is one nevertheless.
E.g. When comparing temperature charts from different places in different timezones, you may want to show them in a way that "noon local time" is on the same place of the X-axis in both cases.
Or more usual: I keep a log of what I do during a day. If I now move to another timezone and want to look at the log, I don't want the times shown in my current timezone. I want the timezone I was in back then.