Ghost/core/client/utils/date-formatting.js
Hannah Wolfe 8836375ca6 Ember cleanup: single quotes for JS
- All JS should use single quotes
2014-06-01 21:53:16 +01:00

22 lines
673 B
JavaScript

/* global moment */
var parseDateFormats = ['DD MMM YY HH:mm',
'DD MMM YYYY HH:mm',
'DD/MM/YY HH:mm',
'DD/MM/YYYY HH:mm',
'DD-MM-YY HH:mm',
'DD-MM-YYYY HH:mm',
'YYYY-MM-DD HH:mm'],
displayDateFormat = 'DD MMM YY @ HH:mm';
//Parses a string to a Moment
var parseDateString = function (value) {
return value ? moment(value, parseDateFormats) : '';
};
//Formats a Date or Moment
var formatDate = function (value) {
return value ? moment(value).format(displayDateFormat) : '';
};
export {parseDateString, formatDate};