mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Revert "[timezones] Add comment explaining moment to Date conversion"
This reverts commit 4516b9e00e
.
This commit is contained in:
parent
a953e82e3f
commit
8b50da33cb
1 changed files with 1 additions and 10 deletions
|
@ -3,13 +3,6 @@ define(function (require) {
|
|||
var angular = require('angular');
|
||||
var moment = require('moment');
|
||||
|
||||
/**
|
||||
* moment objects can have an associated timezone, and when converting to a Date the
|
||||
* timezone is changed to browser time. This can cause issues, such as a day picker
|
||||
* showing the wrong day.
|
||||
* When a moment date is passed in, offset the timezone so that after converting to a Date object
|
||||
* the day does not appear changed. When reading back, convert to moment and remove the offset.
|
||||
*/
|
||||
require('ui/modules')
|
||||
.get('kibana')
|
||||
.directive('offsetTimezone', function () {
|
||||
|
@ -25,7 +18,6 @@ define(function (require) {
|
|||
// continue to offset the date.
|
||||
var offsetDate = false;
|
||||
|
||||
//Going from Date object to moment
|
||||
function fromDatePicker(value) {
|
||||
if (!value) return;
|
||||
var date = moment(value);
|
||||
|
@ -38,11 +30,10 @@ define(function (require) {
|
|||
return date;
|
||||
}
|
||||
|
||||
//Going from moment to Date object
|
||||
function toDatePicker(value) {
|
||||
if (!value) return;
|
||||
var date = new Date(value.format('YYYY-MM-DDTHH:mm:ss.SSSZ'));
|
||||
|
||||
var date = new Date(value.format('YYYY-MM-DDTHH:mm:ss.SSSZ'));
|
||||
var offset = date.getTimezoneOffset() + value.utcOffset();
|
||||
date.setMinutes(date.getMinutes() + offset);
|
||||
offsetDate = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue