client/src/utils.js
author Riwad Salim
Wed, 15 Aug 2018 23:39:02 +0200
changeset 145 5d2bc8c877ea
parent 74 043477fd5c5c
permissions -rw-r--r--
Adding class for specific css in App, Navbar and SessionList components
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
}