0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Remove unused {{gh-datetime-input}} and related helper

This commit is contained in:
Kevin Ansfield 2017-11-29 17:58:46 +00:00 committed by Aileen Nowak
parent 65d58405ed
commit 95f60f2340
4 changed files with 0 additions and 67 deletions

View file

@ -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);
}
});

View file

@ -1,7 +0,0 @@
{{gh-input datetime
id=inputId
class=inputClass
name=inputName
stopEnterKeyDownPropagation="true"
update=(action (mut datetime))
}}

View file

@ -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
};

View file

@ -1,5 +0,0 @@
// import {formatDate} from 'ghost-admin/utils/date-formatting';
describe('Unit: Util: date-formatting', function () {
it('formats a date or moment');
});