From 28b1c92edb395ef235752d5f9d1322d7da974013 Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Sun, 8 Jun 2025 11:12:56 +0200 Subject: [PATCH] Add RSS date format --- src/utility/date.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utility/date.ts b/src/utility/date.ts index 81d76cc6..1210fc96 100644 --- a/src/utility/date.ts +++ b/src/utility/date.ts @@ -19,12 +19,14 @@ const DATE_STRING_FORMAT_LONG_PLACEHOLDER = '00 000 0000 00:0000'; const DATE_STRING_FORMAT_POSTGRES = 'yyyy-MM-dd HH:mm:ss'; +const DATE_STRING_FORMAT_RSS = 'EEE, dd MMM yyyy HH:mm:ss xx'; + export const VALIDATION_EXAMPLE_POSTGRES = '2025-01-03T21:00:44.000Z'; export const VALIDATION_EXAMPLE_POSTGRES_NAIVE = '2025-01-03 16:00:44'; type AmbiguousTimestamp = number | string; -type Length = 'tiny' | 'short' | 'medium' | 'long'; +type Length = 'tiny' | 'short' | 'medium' | 'long' | 'rss'; export const formatDate = ({ date, @@ -47,6 +49,9 @@ export const formatDate = ({ : DATE_STRING_FORMAT_SHORT_PLACEHOLDER; switch (length) { + case 'rss': + formatString = DATE_STRING_FORMAT_RSS; + break; case 'tiny': formatString = DATE_STRING_FORMAT_TINY; placeholderString = DATE_STRING_FORMAT_TINY_PLACEHOLDER;