When creating a new Date() object with a specific date/time, that passed time is treated as UTC, although it should be localtime. Reproducible: Always Steps to Reproduce: 1. Open attached html file in Konqueror Actual Results: Wrong time is displayed (according to your time zone) Expected Results: The time that is passed to the constructor should be shown. Other browsers, like Firefox or even Konqueror with the WebKit engine, treat the time as local time. The specification does not clearly state whether that time should be treated as UTC or localtime AFAICS, but there's an explicit note in the documentation of the Date.UTC() function: NOTE The UTC function differs from the Date constructor in two ways: it returns a time value as a Number, rather than creating a Date object, and it interprets the arguments in UTC rather than as local time. (http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.4.3)
Created attachment 86908 [details] html file demonstrating the issue
This actually worked fine until 4.9.1 and broke in 4.9.2. I was able to track it down to this commit: https://projects.kde.org/projects/kde/kdelibs/repository/revisions/48dd1fc50277b861b49613c5f46b6f8b10cc932d See https://git.reviewboard.kde.org/r/118947/ for a proposed fix.
Git commit 0137c691cfe02e6fc0c99e2ced15aea149e56b4b by Wolfgang Bauer. Committed on 26/06/2014 at 11:55. Pushed by wbauer into branch 'KDE/4.13'. KJS: treat time correctly as localtime in the Date() constructor Commit 48dd1fc50277b861b49613c5f46b6f8b10cc932d introduced a bug: It factors out the code to convert a time specification to an actual time value into the function makeTimeFromList(). But in that function makeTime(&t, ms, true) is called, whereas the original code called makeTime(&t, ms, false) for the constructor. This patch fixes it by passing the "utc" parameter to makeTime() instead of "true". FIXED-IN: 3.13.3 REVIEW: 118947 M +1 -1 kjs/date_object.cpp http://commits.kde.org/kdelibs/0137c691cfe02e6fc0c99e2ced15aea149e56b4b
Git commit 786e0a7821f195c5a227e72a41d29033851dc2af by Wolfgang Bauer. Committed on 26/06/2014 at 11:55. Pushed by wbauer into branch 'master'. KJS: treat time correctly as localtime in the Date() constructor Commit 48dd1fc50277b861b49613c5f46b6f8b10cc932d introduced a bug: It factors out the code to convert a time specification to an actual time value into the function makeTimeFromList(). But in that function makeTime(&t, ms, true) is called, whereas the original code called makeTime(&t, ms, false) for the constructor. This patch fixes it by passing the "utc" parameter to makeTime() instead of "true". FIXED-IN: 3.13.3 REVIEW: 118947 (cherry picked from commit 0137c691cfe02e6fc0c99e2ced15aea149e56b4b) M +1 -1 kjs/date_object.cpp http://commits.kde.org/kdelibs/786e0a7821f195c5a227e72a41d29033851dc2af
Git commit 198c1819e382aed93a574c6f9d51c7303985a672 by Wolfgang Bauer. Committed on 26/06/2014 at 12:21. Pushed by wbauer into branch 'master'. treat specified time correctly as localtime in the Date() constructor Commit 48dd1fc50277b861b49613c5f46b6f8b10cc932d (in KDE4's kdelibs) introduced a bug: It factors out the code to convert a time specification to an actual time value into the function makeTimeFromList(). But in that function makeTime(&t, ms, true) is called, whereas the original code called makeTime(&t, ms, false) for the constructor. This patch fixes it by passing the "utc" parameter to makeTime() instead of "true". FIXED-IN: 3.13.3 REVIEW: 118947 M +1 -1 src/kjs/date_object.cpp http://commits.kde.org/kjs/198c1819e382aed93a574c6f9d51c7303985a672