I'm building an mvp that has core functionality that involves setting date and times for future reminders. I have become completely overwhelmed by what I've read online. One can't just use UTC time, nor can they just track timezones, because of daylight savings. There are tools like pytz, which is just one more tool I have to learn that'll delay launching.<p>Given I can limit my scope for an MVP, what do you all think is a reasonable approach to handling date and time, for scheduling purposes, for an mvp.
It seems you're using python. The standard lib's date and datetime classes are... not great.<p>A purpose-made library like Delorean [1] or Pendulum [2] will help with handling dates, datetimes, and timezones greatly, despite being another tool to learn. Even Arrow [3], which is popular because of its Moment.js-inspired API, is better than using the builtins, despite muddying a few concepts and making some design choices that I (or the Pendulum author [4]) don't agree with.<p>In the Java world, Java 8's builtin Datetime API and its predecessor Joda-Time are quite possibly the most thoroughly thought-out, expertly designed datetime libraries that exist today. In my opinion, none of the python libraries quite measure up, but Delorean and Pendulum are pretty solid.<p>[1] <a href="http://delorean.readthedocs.io/en/latest/quickstart.html" rel="nofollow">http://delorean.readthedocs.io/en/latest/quickstart.html</a> [2] <a href="https://pendulum.eustace.io/" rel="nofollow">https://pendulum.eustace.io/</a> [3] <a href="http://crsmithdev.com/arrow/" rel="nofollow">http://crsmithdev.com/arrow/</a> [4] <a href="https://pendulum.eustace.io/faq/#why-not-arrow" rel="nofollow">https://pendulum.eustace.io/faq/#why-not-arrow</a>
Make an API call to Google? ][1] <a href="https://developers.google.com/maps/documentation/timezone/start" rel="nofollow">https://developers.google.com/maps/documentation/timezone/st...</a><p>An API call is going to be easier to implement than learning a new library.<p>[1]: Alternatives here: <a href="https://stackoverflow.com/questions/16086962/how-to-get-a-time-zone-from-a-location-using-latitude-and-longitude-coordinates" rel="nofollow">https://stackoverflow.com/questions/16086962/how-to-get-a-ti...</a>
Store in whatever format your scheduler uses, which is probably UTC or crontab format, no? For an MVP it doesn't matter as long as it works.<p>After you outgrow your MVP the standard way to store datetimes for scheduling and rendering is:<p>1. <i>Always</i> store datetimes as UTC. You keep seeing this because it's correct. Yes you can store in UTC and display or schedule in another timezone. Scheduling is easy when everything is in UTC.<p>2. Keep an Olson timezone string (America/Los_Angeles) for each user server-side. Create a template filter for django/flask to render your datetimes for the given user's timezone. This is trivial for pytz and the built-in Python datetime library.<p>3. Use Moment.js and Moment-Timezone to render utc datetimes in the user's current browser timezone. You can choose to use the server-side timezone or the browser's timezone when rendering. I personally always use the server-side timezone.<p>Always do 1 and 2. 3 is optional if you prefer rendering datetimes server-side.<p>Edit: Why the downvotes? Anyone care to comment on why you think this way is wrong? It's been working great for <a href="https://wakatime.com" rel="nofollow">https://wakatime.com</a>