Skip to content

Commit e0fcf63

Browse files
committed
MAGETWO-51629: Incorrect current time in date pickers
- fix for bamboo unit test
1 parent 5b891b8 commit e0fcf63

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ require([
5050
showTime: false,
5151
showHour: false,
5252
showMinute: false,
53-
serverTimezoneOffset: <?php echo (int) $block->getTimezoneOffsetSeconds(); ?>,
53+
serverTimezoneSeconds: <?php echo (int) $block->getStoreTimestamp(); ?>,
5454
yearRange: '<?php /* @escapeNotVerified */ echo $block->getYearRange() ?>'
5555
}
5656
});

lib/web/mage/calendar.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,10 @@
323323
// Get local time in ms
324324
var ms = Date.now();
325325

326-
// Adjust milliseconds according to store timezone offset
327-
// Mind the GMT zero offset
328-
if (typeof this.options.serverTimezoneOffset !== 'undefined') {
329-
// Make UTC time and add store timezone offset in seconds
330-
ms += (new Date().getTimezoneOffset() * 60 * 1000) + this.options.serverTimezoneOffset * 1000;
326+
// Use store timestamp based on store timezone settings
327+
if (typeof this.options.serverTimezoneSeconds !== 'undefined') {
328+
//Adjust milliseconds according to client local timezone offset
329+
ms = (this.options.serverTimezoneSeconds + new Date().getTimezoneOffset() * 60) * 1000;
331330
}
332331

333332
return new Date(ms);

0 commit comments

Comments
 (0)