Getting the difference between two dates or datetime objects in python is delightfully straightforward; you can just subtract them! For date objects The subtraction returns an object of class timedelta, which has a few handy properties like .seconds and .days. If using whole date objects however, only the .days property will matter. Since there’s no […]
Dates
Calculate Date Difference in Javascript
You have two main options: Let’s go through a quick example of each approach. Using date-fns to get date difference Above, I mentioned luxon, day.js, and date-fns. They’re all great packages, but I personally prefer date-fns due to its easily searchable documentation. date-fns has a ton of other functionality and the docs are very good […]
Convert between timezones in Javascript
Javascript dates are frequently stored in UTC, or Coordinated Universal Time, specifically so we don’t have to store time-zone-adjusted dates. You’ll often see ISO-formatted date strings ending in Z like this: 2022-12-15T21:07:49.883Z. That Z means “Zulu”, and is just military jargon for “UTC”. Greenwich Mean Time (GMT) is also exactly the same: GMT === UTC […]