From 1df6a8ec0f2b2864ef19e941bbb35fcb57b2ae79 Mon Sep 17 00:00:00 2001 From: WickyNilliams Date: Thu, 23 May 2024 16:16:01 +0100 Subject: [PATCH] use UTC methods on Date when getting day names --- CHANGELOG.md | 6 ++++++ src/utils/hooks.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3178fb..8d3fd49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.1] - 2024-05-23 + +### Fixed + +- Use UTC-based methods on `Date` when getting day names + ## [0.6.0] - 2024-05-10 ### Added diff --git a/src/utils/hooks.ts b/src/utils/hooks.ts index be0897e..9be1997 100644 --- a/src/utils/hooks.ts +++ b/src/utils/hooks.ts @@ -88,9 +88,9 @@ export function useDayNames( const day = new Date(); for (var i = 0; i < 7; i++) { - const index = (day.getDay() - firstDayOfWeek + 7) % 7; + const index = (day.getUTCDay() - firstDayOfWeek + 7) % 7; days[index] = formatter.format(day); - day.setDate(day.getDate() + 1); + day.setUTCDate(day.getUTCDate() + 1); } return days;