mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-04 04:10:33 +03:00
e7f5dd3204
closes #2419 - Added blur-text-field component, which fires actions on focusOut - Added utils/date-formatting for moment & date functionality consolidation - Added functionality to PostsPostController - Added fixtures: posts/3 & posts/4, posts/slug/test%20title/ - Added Post model saving - Set posts.post as controller for EditorRoute - Added PostSettingsMenuView and template - Added "showErrors" convenience method to notifications
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};
|