client/src/utils.js
author ymh <ymh.work@gmail.com>
Thu, 29 Jul 2021 16:46:20 +0200
changeset 207 c39d91bd16af
parent 74 043477fd5c5c
permissions -rw-r--r--
update dependencies and create new version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
74
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import moment from 'moment'
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
export const defaultDateTimeformat = "YYYY-MM-DDTHH:mm:ss.SSSZ";
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
export const formatTimestamp = (ts) => {
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
  return moment(ts).local().format('H:mm:ss');
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
}
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
export const now = () => {
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
  return moment.utc().format(defaultDateTimeformat);
043477fd5c5c add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
}