Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request focuses on updating the
date-fns
library to version 4.1.0 and refactoring various parts of the codebase to use the new functions provided by this updated version. The most important changes include updating thepackage.json
andpnpm-lock.yaml
files, refactoring thegetWeatherData.ts
file, and making adjustments in other related files.Library update and refactoring:
web/package.json
: Updated thedate-fns
dependency from version 3.6.0 to 4.1.0.web/pnpm-lock.yaml
: Updated thedate-fns
version from 3.6.0 to 4.1.0 in multiple sections includingimporters
,packages
, andsnapshots
. [1] [2] [3]Code refactoring to use new
date-fns
functions:web/src/api/getWeatherData.ts
: Refactored to useaddHours
andsubHours
instead ofadd
andsub
for better clarity and performance. [1] [2] [3]web/src/features/time/HistoricalTimeHeader.tsx
: Refactored to useaddDays
,subDays
, andsubHours
for date manipulations. [1] [2] [3] [4]Additional minor adjustments:
web/src/features/service-worker/UpdatePrompt.tsx
: Replaced hardcoded duration value withONE_MINUTE
constant for better readability. [1] [2]web/src/features/weather-layers/grib.ts
: Converted functions to arrow functions for consistency and conciseness.web/src/utils/refetching.ts
: Refactored to useaddHours
for calculating the stale time. [1] [2]