mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
22 lines
673 B
JavaScript
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};
|