From 1660f44f49f99d6209b4fa88cc8cf0e0f772a05d Mon Sep 17 00:00:00 2001 From: Anton Bochkovskyi <98012691+firehawk89@users.noreply.github.com> Date: Sun, 24 Sep 2023 19:35:19 +0300 Subject: [PATCH] Update src/utils/getFormattedDate.js Change default function to arrow function, change function body Co-authored-by: Demian Parkhomenko <95881717+DemianParkhomenko@users.noreply.github.com> --- src/utils/getFormattedDate.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/utils/getFormattedDate.js b/src/utils/getFormattedDate.js index 011444b..0e46832 100644 --- a/src/utils/getFormattedDate.js +++ b/src/utils/getFormattedDate.js @@ -1,9 +1,7 @@ -export default function getFormattedTime(timestamp, options) { - const { format: formatTime } = new Intl.DateTimeFormat('en', { - hour: options.hourOptions, - minute: options.minuteOptions, +export const timeFormatter = (options) => + new Intl.DateTimeFormat('en', { + hour: '2-digit', + minute: '2-digit', hour12: false, + ...options, }) - - return formatTime(timestamp) -}