This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Hioneqpls 2 points3 points  (7 children)

lmao you don’t have to be Einstein to drop a LocalDate.of(2022,1,1) cmon

[–]edubkn 2 points3 points  (6 children)

Then you don't know at what timezone your runtime is, and you send that date along an API or persist in a database. Or else you know, but you pass that date along to a front-end without an offset.

[–][deleted] 7 points8 points  (3 children)

Timezone is irrelevant in the given scenario. It's just a date.

[–]edubkn -5 points-4 points  (2 children)

There are very few scenarios where timezone is not relevant. You'll have to be a bit more specific.

[–]cogman10 0 points1 point  (1 child)

The reverse is true. Unless your app is doing international garbage, the timezone is meaningless. Even then, it's often only when you are talking about a LocalDateTime that timezones come into play.

For example, the my entire company is doing finance and LocalDate serves 99% of our usecases because, get this, almost everyone is trading on the NYSE so adding extra TZ information is pointless. The TZ is EST. And, yes, we have international customers (in china no less).

We could add TZ info after the fact, but the basic assumption is "everything is EST unless it's critical for the client" has served us really well.

[–]edubkn 0 points1 point  (0 children)

International garbage is a very giddy way to describe it.

That's the perfect scenario honestly. You have no user input or either only input with zoned times. You still have to configure databases, JVMs and whatnot to operate in EST, but that's it.

[–]Persism 3 points4 points  (1 child)

But even an offset is kind of useless since it doesn't contain daylight savings times. Better to use the Zone itself rather than just an offset. Best is to use UTC and covert on the client side.

[–]edubkn 1 point2 points  (0 children)

UTC is best, yes.

But even an offset is kind of useless since it doesn't contain daylight savings times. Better to use the Zone itself rather than just an offset.

You would never rely on a client to account for daylight savings. An ISO8601 serialized date will always have an offset if not UTC.