In defense of LocalTime

In defense of LocalTime Wednesday, September 12, 2018 :: Tagged under: . ⏰ 1 minutes. Hey! Thanks for reading! Just a reminder that I wrote this some years ago, and may have much more complicated feelings about this topic than I did when I wrote it. Happy to elaborate, feel free to reach out to me! 😄 og_description: The song for this post is , by . What's a programming abstraction that you feel gets no love? I rarely get mad over engineering decisions anymore, but here's a thing that got me mad, and I'll use this space to air out an unpopular opinion. Here it is: LocalTimes aren't useless. What is LocalTime? LocalTime is an object representing a time (or DateTime) without a timezone. So, "16:00" instead of "16:00 EST". Most time libraries have multiple representations of instants: one with the timezone, and one without (compare Joda-Time's LocalDateTime with DateTime, or Elixir's NaiveDateTime with DateTime). What sucks about LocalTime? If you're storing them, you can't confidently compare them with each other with confidence, since without a timezone, you don't really know when they happened. How do you fix LocalTime? When you're designing an application, the general tips are "you should always normalize you times to UTC" or "you should store times with their time zones." So… why are you defending LocalTime? I found a case where I believe it makes sense to use them. Fitness Burning Man 2018 🔥 → ← Favorite Sketches Thanks for the read! Disagreed? Violent agreement!? Feel free to drop me a line at , or leave a comment below! I'd love to hear from you 😄

This is a companion discussion topic for the original entry at