From 6edd4bcb4efee1bdff45c087efa339d2ab285e66 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 26 Aug 2026 12:10:23 +0200 Subject: [PATCH] Fix date handling in time zone other than UTC --- apps/api/src/app/symbol/symbol.controller.ts | 6 +++--- libs/common/src/lib/helper.ts | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/api/src/app/symbol/symbol.controller.ts b/apps/api/src/app/symbol/symbol.controller.ts index 93db8c87d..d28362175 100644 --- a/apps/api/src/app/symbol/symbol.controller.ts +++ b/apps/api/src/app/symbol/symbol.controller.ts @@ -23,9 +23,9 @@ import { import { REQUEST } from '@nestjs/core'; import { AuthGuard } from '@nestjs/passport'; import { DataSource } from '@prisma/client'; -import { parseISO } from 'date-fns'; +import { isValid, parseISO } from 'date-fns'; import { StatusCodes, getReasonPhrase } from 'http-status-codes'; -import { isDate, isEmpty } from 'lodash'; +import { isEmpty } from 'lodash'; import { SymbolService } from './symbol.service'; @@ -106,7 +106,7 @@ export class SymbolController { ): Promise { const date = parseISO(dateString, { in: utc }); - if (!isDate(date)) { + if (!isValid(date)) { throw new HttpException( getReasonPhrase(StatusCodes.BAD_REQUEST), StatusCodes.BAD_REQUEST diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index 5b668829f..a51a74808 100644 --- a/libs/common/src/lib/helper.ts +++ b/libs/common/src/lib/helper.ts @@ -511,14 +511,6 @@ export function getTextColor(aColorScheme: ColorScheme) { return `${r}, ${g}, ${b}`; } -export function getToday() { - const year = getYear(new Date()); - const month = getMonth(new Date()); - const day = getDate(new Date()); - - return new Date(Date.UTC(year, month, day)); -} - export function getUtc(aDateString: string) { const [yearString, monthString, dayString] = aDateString.split('-');