mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
8836375ca6
- All JS should use single quotes
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};
|