Skip to content

Commit

Permalink
Release v10.2.1 (#3741)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusKjeldgaard authored Dec 16, 2024
1 parent f0d2275 commit f1dad44
Show file tree
Hide file tree
Showing 5 changed files with 672 additions and 7,998 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { addDays, startOfDay, subDays } from 'date-fns';
import { fromZonedTime, toZonedTime } from 'date-fns-tz';
import { utcToZonedTime, zonedTimeToUtc } from 'date-fns-tz';

const config = {
template: `<kirby-card>
Expand Down Expand Up @@ -104,13 +104,13 @@ export class CalendarCardExampleComponent implements OnChanges {
// be misleading and confusing
if (this.useTimezoneUTC) {
// realign local -> selectedDate
this.selectedDate = fromZonedTime(
this.selectedDate = zonedTimeToUtc(
this.subtractTimezoneOffset(this.selectedDate),
this.timeZoneName
);
} else {
// realign UTC -> local
this.selectedDate = toZonedTime(this.selectedDate, this.timeZoneName);
this.selectedDate = utcToZonedTime(this.selectedDate, this.timeZoneName);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/designsystem/calendar/src/calendar.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LOCALE_ID } from '@angular/core';
import { createHostFactory, SpectatorHost } from '@ngneat/spectator';
import { format, Locale, startOfDay, startOfMonth } from 'date-fns';
import { fromZonedTime } from 'date-fns-tz';
import { zonedTimeToUtc } from 'date-fns-tz';

import { TestHelper } from '@kirbydesign/designsystem/testing';
import { WindowRef } from '@kirbydesign/designsystem/types';
Expand Down Expand Up @@ -891,7 +891,7 @@ describe('CalendarComponent', () => {
}

function utcMidnightDate(yyyyMMdd) {
return fromZonedTime(yyyyMMdd, 'UTC');
return zonedTimeToUtc(yyyyMMdd, 'UTC');
}

function clickDayOfMonth(dateOneIndexed: number) {
Expand Down
12 changes: 6 additions & 6 deletions libs/designsystem/calendar/src/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
startOfMonth,
startOfWeek,
} from 'date-fns';
import { fromZonedTime, toZonedTime } from 'date-fns-tz';
import { utcToZonedTime, zonedTimeToUtc } from 'date-fns-tz';
import { da, enGB, enUS } from 'date-fns/locale';

import { capitalizeFirstLetter } from '@kirbydesign/core';
Expand Down Expand Up @@ -301,11 +301,11 @@ export class CalendarComponent implements OnInit, OnChanges {
return dateLocalOrUTC;
}
if (
startOfDay(toZonedTime(dateLocalOrUTC, this.timeZoneName)).getTime() ===
toZonedTime(dateLocalOrUTC, this.timeZoneName).getTime()
startOfDay(utcToZonedTime(dateLocalOrUTC, this.timeZoneName)).getTime() ===
utcToZonedTime(dateLocalOrUTC, this.timeZoneName).getTime()
) {
// the date is a UTC midnight; create the equivalent local timezone midnight date
const normalizedUTCdate = toZonedTime(dateLocalOrUTC, this.timeZoneName);
const normalizedUTCdate = utcToZonedTime(dateLocalOrUTC, this.timeZoneName);
return normalizedUTCdate;
}
// does not point to midnight so we make it
Expand Down Expand Up @@ -440,7 +440,7 @@ export class CalendarComponent implements OnInit, OnChanges {
let newDate = new Date(newDay.year, newDay.monthIndex, newDay.date);

if (this.timezone === 'UTC') {
newDate = fromZonedTime(this.subtractTimezoneOffset(newDate), this.timeZoneName);
newDate = zonedTimeToUtc(this.subtractTimezoneOffset(newDate), this.timeZoneName);
}

const dateToEmit = newDate;
Expand Down Expand Up @@ -548,7 +548,7 @@ export class CalendarComponent implements OnInit, OnChanges {
if (!newDate) return;

if (this.timezone === 'UTC') {
newDate = fromZonedTime(this.subtractTimezoneOffset(newDate), this.timeZoneName);
newDate = zonedTimeToUtc(this.subtractTimezoneOffset(newDate), this.timeZoneName);
}

const today = this.getTodayDate();
Expand Down
6 changes: 3 additions & 3 deletions libs/designsystem/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kirbydesign/designsystem",
"version": "10.2.0",
"version": "10.2.1",
"description": "The Kirby Design Angular Components.",
"author": "kirby@bankdata.dk",
"repository": {
Expand Down Expand Up @@ -35,8 +35,8 @@
"chartjs-adapter-date-fns": "^2.0.0",
"chartjs-plugin-annotation": "^1.0.2",
"chartjs-plugin-datalabels": "^2.0.0",
"date-fns": "^4.1.0",
"date-fns-tz": "^3.2.0",
"date-fns": "^2.30.0",
"date-fns-tz": "^1.3.8",
"rxjs": "^7.0.0",
"swiper": "^9.2.0",
"zone.js": "^0.14.3"
Expand Down
Loading

0 comments on commit f1dad44

Please sign in to comment.