format-date.js 404 B

1234567891011121314151617181920
  1. import moment from 'moment'
  2. moment.updateLocale('en', {
  3. calendar: {
  4. lastDay: '[Yesterday]',
  5. sameDay: '[Today]',
  6. nextDay: '[Tomorrow]',
  7. lastWeek: 'ddd, Do MMM YY',
  8. nextWeek: 'ddd, Do MMM YY',
  9. sameElse: 'ddd, Do MMM YY',
  10. },
  11. })
  12. export function formatTime(date) {
  13. return moment(date).format('h:mm a')
  14. }
  15. export function relativeDate(date) {
  16. return moment(date).calendar()
  17. }