diff --git a/ghost/admin/app/components/gh-datetime-input.js b/ghost/admin/app/components/gh-datetime-input.js deleted file mode 100644 index f7b7204196..0000000000 --- a/ghost/admin/app/components/gh-datetime-input.js +++ /dev/null @@ -1,34 +0,0 @@ -import Component from '@ember/component'; -import boundOneWay from 'ghost-admin/utils/bound-one-way'; -import moment from 'moment'; -import {InvokeActionMixin} from 'ember-invoke-action'; -import {formatDate} from 'ghost-admin/utils/date-formatting'; -import {inject as service} from '@ember/service'; - -export default Component.extend(InvokeActionMixin, { - tagName: 'span', - classNames: 'gh-input-icon gh-icon-calendar', - - datetime: boundOneWay('value'), - inputClass: null, - inputId: null, - inputName: null, - settings: service(), - - didReceiveAttrs() { - let datetime = this.get('datetime') || moment.utc(); - let blogTimezone = this.get('settings.activeTimezone'); - - if (!this.get('update')) { - throw new Error(`You must provide an \`update\` action to \`{{${this.templateName}}}\`.`); - } - - this.set('datetime', formatDate(datetime || moment.utc(), blogTimezone)); - }, - - focusOut() { - let datetime = this.get('datetime'); - - this.invokeAction('update', datetime); - } -}); diff --git a/ghost/admin/app/templates/components/gh-datetime-input.hbs b/ghost/admin/app/templates/components/gh-datetime-input.hbs deleted file mode 100644 index 8c71f294f5..0000000000 --- a/ghost/admin/app/templates/components/gh-datetime-input.hbs +++ /dev/null @@ -1,7 +0,0 @@ -{{gh-input datetime - id=inputId - class=inputClass - name=inputName - stopEnterKeyDownPropagation="true" - update=(action (mut datetime)) -}} diff --git a/ghost/admin/app/utils/date-formatting.js b/ghost/admin/app/utils/date-formatting.js deleted file mode 100644 index 6b267480ff..0000000000 --- a/ghost/admin/app/utils/date-formatting.js +++ /dev/null @@ -1,21 +0,0 @@ -import moment from 'moment'; - -const displayDateFormat = 'DD MMM YY @ HH:mm'; - -// Add missing timestamps -function verifyTimeStamp(dateString) { - if (dateString && !dateString.slice(-5).match(/\d+:\d\d/)) { - dateString += ' 12:00'; - } - return dateString; -} - -// Formats a Date or Moment -function formatDate(value, timezone) { - // we output the date adjusted to the blog timezone selected in settings - return verifyTimeStamp(value ? moment(value).tz(timezone).format(displayDateFormat) : ''); -} - -export { - formatDate -}; diff --git a/ghost/admin/tests/unit/utils/date-formatting-test.js b/ghost/admin/tests/unit/utils/date-formatting-test.js deleted file mode 100644 index e993738e0d..0000000000 --- a/ghost/admin/tests/unit/utils/date-formatting-test.js +++ /dev/null @@ -1,5 +0,0 @@ -// import {formatDate} from 'ghost-admin/utils/date-formatting'; - -describe('Unit: Util: date-formatting', function () { - it('formats a date or moment'); -});