1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/utils
Aileen Nowak be8b31ec85 Timezones: Always use the timezone of blog setting
closes TryGhost/Ghost#6406

follow-up PR of #2

- adds a `timeZone` Service to provide the offset (=timezone reg. moment-timezone) of the users blog settings
- `gh-datetime-input` will read the offset of the timezone now and adjust the `publishedAt` date with it. This is the date which will be shown in the PSM 'Publish Date' field. When the user writes a new date/time, the offset is considered and will be deducted again before saving it to the model. This way, we always work with a UTC publish date except for this input field.
- gets `availableTimezones` from `configuration/timezones` API endpoint
- adds a `moment-utc` transform on all date attr (`createdAt`, `updatedAt`, `publishedAt`, `unsubscribedAt` and `lastLogin`) to only work with UTC times on serverside
- when switching the timezone in the select box, the user will be shown the local time of the selected timezone
- `createdAt`-property in `gh-user-invited` returns now `moment(createdAt).fromNow()` as `createdAt` is a moment date already
- added clock service to show actual time ticking below select box
- default timezone is '(GMT) Greenwich Mean Time : Dublin, Edinburgh, London'
- if no timezone is saved in the settings yet, the default value will be used
- shows the local time in 'Publish Date'  in PSM by default, until user overwrites it
- adds dependency `moment-timezone 0.5.4` to `bower.json`

---------

**Tests:**

- sets except for clock service in test env
- adds fixtures to mirage
- adds `service.ajax` and `service:ghostPaths` to navigation-test.js
- adds unit test for `gh-format-timeago` helper
- updates acceptance test `general-setting`
- adds acceptance test for `editor`
- adds integration tests for `services/config` and `services/time-zone`

---------

**Todos:**

- [ ] Integration tests: ~~`services/config`~~, ~~`services/time-zone`~~, `components/gh-datetime-input`
- [x] Acceptance test: `editor`
- [ ] Unit tests: `utils/date-formatting`
- [ ] write issue for renaming date properties (e. g. `createdAt` to `createdAtUTC`) and translate those for server side with serializers
2016-06-03 16:23:39 +02:00
..
ajax.js Subscribers: Admin UI updates & fixes 2016-05-11 11:22:35 +02:00
bound-one-way.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
caja-sanitizers.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
ctrl-or-cmd.js Standardize on var-less export default across ember app 2015-10-06 10:59:50 +01:00
date-formatting.js Timezones: Always use the timezone of blog setting 2016-06-03 16:23:39 +02:00
document-title.js deps: ember-suave@2.0.1 2016-04-08 16:27:24 +01:00
ed-image-manager.js Fix editor image perf and upload bug 2016-05-08 12:55:56 +02:00
editor-shortcuts.js Isolate all markdown editor behaviour into gh-editor component 2016-01-13 12:01:31 +00:00
ghost-paths.js Change URL for download count service 2016-02-09 10:20:24 +00:00
isFinite.js Standardize on var-less export default across ember app 2015-10-06 10:59:50 +01:00
isNumber.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
link-component.js convert more action calls to the ember-invoke-action syntax 2016-04-28 10:34:36 -05:00
random-password.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
text-field.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
titleize.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
validator-extensions.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
window-proxy.js Use es6 across client and add ember-suave to enforce rules 2015-11-30 10:41:01 +00:00
word-count.js Drop XRegExp dependency 2016-03-30 19:45:20 +01:00