vets-website icon indicating copy to clipboard operation
vets-website copied to clipboard

DR | Update timezone utility & move to shared

Open Mottie opened this issue 1 month ago • 0 comments

Summary

  • (Summarize the changes that have been made to the platform)

    DataDog & Sentry event showing that Lighthouse rejected an HLR submission due to a timezone of Etc/Unknown. Our frontend uses the following code to determine timezone:

    Intl.DateTimeFormat().resolvedOptions().timeZone
    

    But this is not a valid timezone from the IANA tz database, so Lighthouse rejected it.

  • (If bug, how to reproduce)
  • (What is the solution, why is this the solution)

    Check for unknown in timezone, and return a default of America/New_York as suggested by Lighthouse

  • (Which team do you work for, does your team own the maintenance of this component?)

    Benefits Decision Reviews

  • (If using a flipper, what is the end date of the flipper being required/success criteria being targeted)

Related issue(s)

Testing done

  • Describe what the old behavior was prior to the change

    Pass raw timezone from Intl timezone result

  • Describe the steps required to verify your changes are working as expected

    No idea how to get that built-in JS function to return Etc/Unknown

  • Describe the tests completed and the results

    Added basic test, no stubbing of built in timezone function

  • _Exclusively stating 'Specs and automated tests passing' is NOT acceptable as appropriate testing
  • Optionally, provide a link to your test plan and test execution records

Screenshots

N/A

What areas of the site does it impact?

Decision Reviews: HLR, NOD & Supplemental Claims

Acceptance criteria

Quality Assurance & Testing

  • [x] I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • [x] No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • [ ] Linting warnings have been addressed
  • [ ] Documentation has been updated (link to documentation *if necessary)
  • [ ] Screenshot of the developed feature is added
  • [ ] Accessibility testing has been performed

Error Handling

  • [ ] Browser console contains no warnings or errors.
  • [ ] Events are being sent to the appropriate logging solution
  • [ ] Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • [ ] Did you login to a local build and verify all authenticated routes work as expected with a test user

:warning: Team Sites (only applies to modifications made to the VA.gov header) :warning:

  • [ ] The vets-website header does not contain any web-components
  • [ ] I used the proxy-rewrite steps to test the injected header scenario
  • [ ] I reached out in the #sitewide-public-websites Slack channel for questions

Requested Feedback

(OPTIONAL) What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

Mottie avatar May 13 '24 20:05 Mottie