From e13e630cd6e4fc0b1ff92098a28a770794c7bb9a Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:19:29 -0500 Subject: =?UTF-8?q?A=C3=B1adir=20plantilla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Base para front --- .../odiparpack/app/redux/helpers/dateTimeHelper.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 front/odiparpack/app/redux/helpers/dateTimeHelper.js (limited to 'front/odiparpack/app/redux/helpers') diff --git a/front/odiparpack/app/redux/helpers/dateTimeHelper.js b/front/odiparpack/app/redux/helpers/dateTimeHelper.js new file mode 100644 index 0000000..e91c981 --- /dev/null +++ b/front/odiparpack/app/redux/helpers/dateTimeHelper.js @@ -0,0 +1,35 @@ +export function getDate() { + let today = new Date(); + let dd = today.getDate(); + const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December' + ]; + const mm = monthNames[today.getMonth()]; // January is 0! + const yyyy = today.getFullYear(); + + if (dd < 10) { + dd = '0' + dd; + } + + today = mm + ', ' + dd + ' ' + yyyy; + + return today; +} + +export function getTime() { + let now = new Date(); + let h = now.getHours(); + let m = now.getMinutes(); + + if (h < 10) { + h = '0' + h; + } + + if (m < 10) { + m = '0' + m; + } + + now = h + ':' + m; + return now; +} -- cgit v1.2.3