Bug 149092 - document.lastModified should use the user's local time zone
Summary: document.lastModified should use the user's local time zone
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://html.spec.whatwg.org/multipag...
Keywords: InRadar, WebExposed
: 4363 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-12 12:06 PDT by Chris Dumez
Modified: 2017-11-07 11:14 PST (History)
7 users (show)

See Also:


Attachments
Patch (8.81 KB, patch)
2015-09-12 12:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (10.00 KB, patch)
2015-09-12 22:09 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.60 KB, patch)
2015-09-13 21:17 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-09-12 12:06:39 PDT
document.lastModified should use the user's local time zone:
https://html.spec.whatwg.org/multipage/dom.html#dom-document-lastmodified

Chrome and Firefox comply with the specification. However, it looks like WebKit returns UTC (7 hours difference on my machine).
Comment 1 Chris Dumez 2015-09-12 12:07:02 PDT
rdar://problem/22567705
Comment 2 Chris Dumez 2015-09-12 12:37:27 PDT
Created attachment 261062 [details]
Patch
Comment 3 Alexey Proskuryakov 2015-09-12 20:07:52 PDT
Comment on attachment 261062 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261062&action=review

> LayoutTests/http/tests/misc/last-modified-parsing-expected.txt:6
> +11/20/2008 17:03:33

What will happen with this test if my time zone is not PST?
Comment 4 Chris Dumez 2015-09-12 20:13:08 PDT
Comment on attachment 261062 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261062&action=review

>> LayoutTests/http/tests/misc/last-modified-parsing-expected.txt:6
>> +11/20/2008 17:03:33
> 
> What will happen with this test if my time zone is not PST?

Good point. I should probably edit the test so that it prints UTC time.
Comment 5 Chris Dumez 2015-09-12 22:09:55 PDT
Created attachment 261075 [details]
Patch
Comment 6 Chris Dumez 2015-09-12 22:10:17 PDT
(In reply to comment #3)
> Comment on attachment 261062 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=261062&action=review
> 
> > LayoutTests/http/tests/misc/last-modified-parsing-expected.txt:6
> > +11/20/2008 17:03:33
> 
> What will happen with this test if my time zone is not PST?

This is addressed in the latest iteration of the patch.
Comment 7 Daniel Bates 2015-09-13 16:46:11 PDT
Comment on attachment 261075 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261075&action=review

> Source/WebCore/ChangeLog:17
> +        No new tests, already covered by existing tests.
> +

Do we have any tests/infrastructure to check the correctness of document.lastModified with respect to different time zones? If not, then I suggest that we add infrastructure to support changing to a time zone t at runtime and tests to ensure that document.lastModified is correct with respect t.
Comment 8 Daniel Bates 2015-09-13 16:46:11 PDT
Comment on attachment 261075 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261075&action=review

> Source/WebCore/ChangeLog:17
> +        No new tests, already covered by existing tests.
> +

Do we have any tests/infrastructure to check the correctness of document.lastModified with respect to different time zones? If not, then I suggest that we add infrastructure to support changing to a time zone t at runtime and tests to ensure that document.lastModified is correct with respect t.
Comment 9 Chris Dumez 2015-09-13 16:56:30 PDT
(In reply to comment #8)
> Comment on attachment 261075 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=261075&action=review
> 
> > Source/WebCore/ChangeLog:17
> > +        No new tests, already covered by existing tests.
> > +
> 
> Do we have any tests/infrastructure to check the correctness of
> document.lastModified with respect to different time zones? If not, then I
> suggest that we add infrastructure to support changing to a time zone t at
> runtime and tests to ensure that document.lastModified is correct with
> respect t.

I don't believe we currently have test infrastructure for changing the system's timezone. While this would potentially be a nice thing to have, I don't believe this is a pre-requirement for this patch though. The existing W3C tests check that document.lastModified is using the current system timezone. They used to fail for every timezone other than UTC and now they pass.
Comment 10 Ryosuke Niwa 2015-09-13 21:07:49 PDT
Comment on attachment 261075 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261075&action=review

>>>> Source/WebCore/ChangeLog:17
>>>> +
>>> 
>>> Do we have any tests/infrastructure to check the correctness of document.lastModified with respect to different time zones? If not, then I suggest that we add infrastructure to support changing to a time zone t at runtime and tests to ensure that document.lastModified is correct with respect t.
>> 
>> Do we have any tests/infrastructure to check the correctness of document.lastModified with respect to different time zones? If not, then I suggest that we add infrastructure to support changing to a time zone t at runtime and tests to ensure that document.lastModified is correct with respect t.
> 
> I don't believe we currently have test infrastructure for changing the system's timezone. While this would potentially be a nice thing to have, I don't believe this is a pre-requirement for this patch though. The existing W3C tests check that document.lastModified is using the current system timezone. They used to fail for every timezone other than UTC and now they pass.

I don't think changing the system clock's timezone is a realistic solution since we parallelize tests.
In any case, I don't think we should block this patch for adding such a test infrastructure.

> LayoutTests/ChangeLog:15
> +2015-09-12  Chris Dumez  <cdumez@apple.com>

Duplicated change log entries.
Comment 11 Chris Dumez 2015-09-13 21:17:40 PDT
Created attachment 261098 [details]
Patch
Comment 12 Chris Dumez 2015-09-13 21:18:30 PDT
Comment on attachment 261098 [details]
Patch

Clearing flags on attachment: 261098

Committed r189679: <http://trac.webkit.org/changeset/189679>
Comment 13 Chris Dumez 2015-09-13 21:18:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Alexey Proskuryakov 2017-11-07 11:14:58 PST
*** Bug 4363 has been marked as a duplicate of this bug. ***