From 5627cc11ecd321548c19517696dc21a9154449bf Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Mon, 30 Sep 2024 11:00:34 +0200 Subject: [PATCH] - updated proper displaying of dates with leading zero; --- src/helpers/getDateFromISOstring.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/helpers/getDateFromISOstring.js b/src/helpers/getDateFromISOstring.js index aeb66ca..106c49d 100644 --- a/src/helpers/getDateFromISOstring.js +++ b/src/helpers/getDateFromISOstring.js @@ -1,6 +1,9 @@ -const getDateFromISOstring = (value, options = {}) => { - const optionsMerged = options || { day: '2-digit', month: '2-digit', year: 'numeric', hour12: false } - return value ? Intl.DateTimeFormat('it-IT', optionsMerged).format(new Date(value)) : value; +const getDateFromISOstring = ( + value, + options = { + day: '2-digit', month: '2-digit', year: 'numeric', hour12: false + }) => { + return value ? Intl.DateTimeFormat('it-IT', options).format(new Date(value)) : value; } export default getDateFromISOstring; \ No newline at end of file