Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Merge branch '1.7' into 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Dec 18, 2018
2 parents eb973ed + b8dfa04 commit 1c893a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Resources/public/js/views/fields/ez-date-editview.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ YUI.add('ez-date-editview', function (Y) {
* @protected
*/
_syncDateAttribute: function () {
var field = this.get('field');
var field = this.get('field'),
date;

if ( this._containsValidTimestamp() ) {
this._set('date', Y.Date.format(new Date(field.fieldValue.timestamp * 1000)));
date = new Date(field.fieldValue.timestamp * 1000);

date.setTime(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
this._set('date', Y.Date.format(date));
}
},

Expand Down Expand Up @@ -260,6 +264,8 @@ YUI.add('ez-date-editview', function (Y) {
}
if ( this._containsValidTimestamp() ) {
date = new Date(field.fieldValue.timestamp * 1000);

date.setTime(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
}
calendar = new Y.Calendar({
showPrevMonth: true,
Expand Down
7 changes: 4 additions & 3 deletions Resources/public/js/views/fields/ez-date-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ YUI.add('ez-date-view', function (Y) {
},

/**
* Formats the date part of the date object according to the locale
* settings of the browser
* Formats the date part of the date object.
*
* Uses UTC as that is what the date is stored in on server side.
*
* @method _formatDate
* @protected
Expand All @@ -60,7 +61,7 @@ YUI.add('ez-date-view', function (Y) {
*/
_formatDate: function (date) {
return date.toLocaleDateString(
undefined, {year: "numeric", month: "short", day: "numeric"}
undefined, {year: "numeric", month: "short", day: "numeric", timeZone: "UTC"}
);
},
});
Expand Down

0 comments on commit 1c893a2

Please # to comment.