From 0bfcaee5b35c8838dcd890e34d82591e5232b076 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 24 Feb 2025 17:46:00 +0100 Subject: [PATCH 1/2] (bug) machine reservation time in my reservations is incorrect --- CHANGELOG.md | 2 ++ app/frontend/src/javascript/lib/format.ts | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26b20d6e5..aaa31d697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +- Fix a bug: machine reservation time in my reservations is incorrect + ## v6.3.39 2025 February 3 - Fix a bug: unable to cancel a PayZen subscription diff --git a/app/frontend/src/javascript/lib/format.ts b/app/frontend/src/javascript/lib/format.ts index 3325710e9..a2e3c4395 100644 --- a/app/frontend/src/javascript/lib/format.ts +++ b/app/frontend/src/javascript/lib/format.ts @@ -62,7 +62,7 @@ export default class FormatLib { */ private static parseISOtime = (date: TDateISO|TDateISOShortTime): Date => { const isoTimeMatch = (date as string)?.match(/(^|T)(\d\d:\d\d)/); - return new Date(`1970-01-01T${isoTimeMatch[2]}:00${Fablab.timezone_offset}`); + return new Date(`${moment().format('YYYY-MM-DD')}T${isoTimeMatch[2]}:00${Fablab.timezone_offset}`); }; /** @@ -77,10 +77,10 @@ export default class FormatLib { */ static time = (date: Date|TDateISO|TDateISOShortTime): string => { let tempDate: Date; - if (FormatLib.isShortTimeISO(date as string) || FormatLib.isDateISO(date as string)) { + if (FormatLib.isShortTimeISO(date as string)) { tempDate = FormatLib.parseISOtime(date as TDateISOShortTime); } else { - tempDate = moment(date).toDate(); + tempDate = moment.utc(date).toDate(); } return Intl.DateTimeFormat(Fablab.intl_locale, { hour: 'numeric', minute: 'numeric', timeZone: Fablab.timezone }).format(tempDate); }; From a6ecc0ebb56093a247aa3541cb341f2a4c81b0cf Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 24 Feb 2025 17:49:55 +0100 Subject: [PATCH 2/2] Version 6.3.40 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaa31d697..929e0b718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +## v6.3.40 2025 February 24 + - Fix a bug: machine reservation time in my reservations is incorrect ## v6.3.39 2025 February 3 diff --git a/package.json b/package.json index 78147bc95..8f7a49b6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "6.3.39", + "version": "6.3.40", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "keywords": [ "fablab",