Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
2
stevekrouse avatar

There are a lot of lookups here that can be cached:

  1. Getting your lat, lon could be done once and cached
  2. Getting your weather.gov grid could also be done infrequently and cached

However, this val only runs once per day, and it doesn't really matter if it takes 500ms or 900ms.

stevekrouse avatar

The hardest part of this val was getting all the date manipulation (parsing, formatting, checking for today) to happen in the timezone of the location you're working with.

It was a big upgrade when I switched from JS Date to Luxon. It's convenient that the weatherGov library gives you a timezone!

Updated: December 8, 2023