Browse Source

New Chapter: Timezones

master
Julio Biason 5 years ago
parent
commit
23951d6c0e
  1. 1
      content/books/things-i-learnt/_index.md
  2. 2
      content/books/things-i-learnt/languages-are-more/index.md
  3. 2
      content/books/things-i-learnt/resist-easy/index.md
  4. 35
      content/books/things-i-learnt/use-timezones/index.md

1
content/books/things-i-learnt/_index.md

@ -39,6 +39,7 @@ template = "section-contentless.html"
* [If Your Data Has a Schema, Use a Structure](use-structures) * [If Your Data Has a Schema, Use a Structure](use-structures)
* [Don't Mess With Things Outside Your Project](outside-project) * [Don't Mess With Things Outside Your Project](outside-project)
* [Resist The Temptation Of Easy](resist-easy) * [Resist The Temptation Of Easy](resist-easy)
* [Always Use Timezones With Your Dates](use-timezones)
* Community/Teams * Community/Teams
* [A Language Is Much More Than A Language](languages-are-more) * [A Language Is Much More Than A Language](languages-are-more)
* [Understand And Stay Away From Cargo Cult](cargo-cult) * [Understand And Stay Away From Cargo Cult](cargo-cult)

2
content/books/things-i-learnt/languages-are-more/index.md

@ -39,4 +39,4 @@ surface of what the whole of a language encapsulates and if you ignore the
other elements in it, you may find yourself with a cute language in a other elements in it, you may find yourself with a cute language in a
community that is always fighting and never going forward. community that is always fighting and never going forward.
{{ chapters(prev_chapter_link="/books/things-i-learnt/resist-easy", prev_chapter_title="Resist The Temptation Of Easy", next_chapter_link="/books/things-i-learnt/outside-project", next_chapter_title="Don't Mess With Things Outside Your Project") }} {{ chapters(prev_chapter_link="/books/things-i-learnt/use-timezones", prev_chapter_title="Always Use Timezones With Your Dates", next_chapter_link="/books/things-i-learnt/outside-project", next_chapter_title="Don't Mess With Things Outside Your Project") }}

2
content/books/things-i-learnt/resist-easy/index.md

@ -28,4 +28,4 @@ These days, IDEs can autocomplete almost everything, from function names to
even how to name your variables. But using the autocomplete is not always a even how to name your variables. But using the autocomplete is not always a
good solution. Finding better names is. good solution. Finding better names is.
{{ chapters(prev_chapter_link="/books/things-i-learnt/outside-project", prev_chapter_title="Don't Mess With Things Outside Your Project", next_chapter_link="/books/things-i-learnt/languages-are-more", next_chapter_title="A Language Is Much More Than A Language") }} {{ chapters(prev_chapter_link="/books/things-i-learnt/outside-project", prev_chapter_title="Don't Mess With Things Outside Your Project", next_chapter_link="/books/things-i-learnt/use-timezones", next_chapter_title="Always Use Timezones With Your Dates") }}

35
content/books/things-i-learnt/use-timezones/index.md

@ -0,0 +1,35 @@
+++
title = "Things I Learnt The Hard Way - Always Use Timezones With Your Dates"
date = 2019-07-01
[taxonomies]
tags = ["en-au", "books", "things i learnt", "dates", "timezones"]
+++
No matter if the date you're receiving is in your local timezone and you'll
display it in your timezone. Sooner or later, the fact that you ignored there
was a timezone behind that date will hurt you.
<!-- more -->
(Note: Most of this post when I say "date" you can think of "date and time",
although the date should also be timezone aware.)
At some point of my professional life, ignoring timezones was easy: You just
pick the date, throw in the database, then read it back and everybody was
happy.
But things are not like this anymore. People will access your site from far
away locations, the source of the date may not be in the same timezone of your
system, your system may be running in a completely different timezone of your
dev machine (it's pretty common to run things in our machines in the local
timezone but the production system will run in UTC), the display may be a
complete different timezone than your production and dev machine and so on.
So always carry the timezone with the data. Find modules/classes that support
dates with timezones (a.k.a. make things _timezone aware_), capture the
timezone as soon as possible and carry it around in all operations.
Modules/classes that don't support timezones for dates/times should, as soon
as possible, removed from the system.
{{ chapters(prev_chapter_link="/books/things-i-learnt/use-timezones", prev_chapter_title="Always Use Timezones With Your Dates", next_chapter_link="/books/things-i-learnt/languages-are-more", next_chapter_title="A Language Is Much More Than A Language") }}
Loading…
Cancel
Save