act-now-coalition / act-now-packages

NPM Packages for Act Now Coalition
https://act-now-packages.web.app/
MIT License
4 stars 1 forks source link

Allow raw years (2020) as date strings in CSV / JSON files. #584

Closed mikelehen closed 1 year ago

mikelehen commented 1 year ago

Fixes #560

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: c7ff08dcc5e634698a51ab5a00daa381c57a59a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------------- | ----- | | @actnowcoalition/actnow.js | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 1 year ago

Visit the preview URL for this PR (updated for commit c7ff08d):

https://act-now-packages--pr584-mikelehen-support-ye-p5aod12q.web.app

(expires Tue, 14 Feb 2023 19:18:21 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: ad39b6c29b2ae4e8fa7983fbf3316d2e514cb069

mikelehen commented 1 year ago

Yeah, the problem is actually a bit subtle. It's related to the fact that CSVs don't differentiate numbers from strings so we have to infer the type and if you had a raw year date (2022) in a CSV we would parse it to a number and then reject it. I realized though that we can "fix" that and force the date column to be parsed as a string. That's probably a bit cleaner. So I went ahead and tweaked the logic to do that.