Skip to content

Commit

Permalink
Post settings published_at date improvements & fixes
Browse files Browse the repository at this point in the history
closes TryGhost#1866, fixes TryGhost#2067, fixes TryGhost#2068

- Upgrade client side moment to 2.4.0 to match the server side script.
- Add a guard to pub date to fix TryGhost#2067
- Add new format to close TryGhost#1866
  • Loading branch information
ErisDS committed Jan 29, 2014
1 parent 1afeeaf commit 47c5e5a
Show file tree
Hide file tree
Showing 2 changed files with 835 additions and 182 deletions.
7 changes: 4 additions & 3 deletions core/client/views/post-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
(function () {
"use strict";

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'],
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';

Ghost.View.PostSettings = Ghost.View.extend({
Expand Down Expand Up @@ -158,7 +158,8 @@
e.preventDefault();
var self = this,
errMessage = '',
pubDate = moment(self.model.get('published_at')).format(displayDateFormat),
pubDate = self.model.get('published_at') ? moment(self.model.get('published_at'))
.format(displayDateFormat) : '',
pubDateEl = e.currentTarget,
newPubDate = pubDateEl.value,
pubDateMoment,
Expand Down
Loading

0 comments on commit 47c5e5a

Please sign in to comment.