diff --git a/CHANGELOG.md b/CHANGELOG.md index dbe8942..1fb222b 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](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.3.1] - 2026-02-04 + +### Updated + +- Updated functions of the `DateFormatter` to a newer version + ## [2.3.0] - 2026-02-04 ### Added diff --git a/package.json b/package.json index b90ec49..f3ee616 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "publishConfig": { "access": "public" }, - "version": "2.3.0", + "version": "2.3.1", "license": "MIT", "private": false, "engines": { diff --git a/src/util/PatternCompiler/Plugin/DateFormatter.ts b/src/util/PatternCompiler/Plugin/DateFormatter.ts index b91f404..087527d 100644 --- a/src/util/PatternCompiler/Plugin/DateFormatter.ts +++ b/src/util/PatternCompiler/Plugin/DateFormatter.ts @@ -81,11 +81,12 @@ export class DateFormatter { static getZoneAdjustedWeekday = ( dateString: string, options: { - timezone: string; + timezone: string | undefined; locale: string | undefined; - } + }, + defaultTimeZone: string = 'Europe/Berlin' ) => { - const timezone = options.timezone; + const timezone = options.timezone ?? defaultTimeZone; return new Date(dateString).toLocaleDateString(options.locale, { weekday: 'long', @@ -96,11 +97,12 @@ export class DateFormatter { static getZoneAdjustedDate = ( dateString: string, options: { - timezone: string; + timezone: string | undefined; locale: string | undefined; - } + }, + defaultTimeZone: string = 'Europe/Berlin' ) => { - const timezone = options.timezone; + const timezone = options.timezone ?? defaultTimeZone; return new Date(dateString).toLocaleDateString(options.locale, { month: 'long', @@ -112,11 +114,12 @@ export class DateFormatter { static getZoneAdjustedTime = ( dateString: string, options: { - timezone: string; + timezone: string | undefined; locale: string | undefined; - } + }, + defaultTimeZone: string = 'Europe/Berlin' ) => { - const timezone = options.timezone; + const timezone = options.timezone ?? defaultTimeZone; return new Date(dateString) .toLocaleTimeString(options.locale, {