Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: LayoutTests/http/tests/misc/last-modified-parsing.html

Issue 394903004: document.lastModified should consider user's local time zone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Finger crossed Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/misc/last-modified-parsing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 if (window.testRunner) { 2 if (window.testRunner) {
3 testRunner.dumpAsText(); 3 testRunner.dumpAsText();
4 testRunner.dumpChildFramesAsText(); 4 testRunner.dumpChildFramesAsText();
5 } 5 }
6 6
7 function getExpectedLastModified(lastModified) {
8 var date = new Date(lastModified);
9 if (window.internals) {
10 var offset = date.getTimezoneOffset() * 60 * 1000;
11 var ms = date.getTime() + offset;
12 date = new Date(internals.convertToLocalTime(ms));
tkent 2014/07/24 06:20:05 Did you investigate why local time representation
kangil_ 2014/07/24 11:35:28 After further investigation, I've found that calcu
13 }
14 var month = ("0" + (date.getMonth() + 1)).slice(-2);
15 var day = ("0" + date.getDate()).slice(-2);
16 var hour = ("0" + date.getHours()).slice(-2);
17 var minute = ("0" + date.getMinutes()).slice(-2);
18 var second = ("0" + date.getSeconds()).slice(-2);
19 var result = month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + minute + ':' + second;
20 return result;
21 }
22
7 function test(text) { 23 function test(text) {
8 document.write('<iframe src="../resources/last-modified.php?date=' + escape( text) + '"></iframe>'); 24 var url = '../resources/last-modified.php?date=' + escape(text) + '&expected =' + escape(getExpectedLastModified(text));
25 document.write('<iframe id="test" src="' + url + '"></iframe>');
9 } 26 }
10 27
11 test('Mon, 21 Nov 2008 01:03:33 GMT'); 28 test('Mon, 21 Nov 2008 01:03:33 GMT');
12 test('Tuesday, 21 Nov 2008 01:03:33 GMT'); 29 test('Tuesday, 21 Nov 2008 01:03:33 GMT');
13 test('Mon, 21 Nov 97 01:03:33 GMT'); 30 test('Mon, 21 Nov 97 01:03:33 GMT');
14 test('Mon, 21-Nov-2008 01:03:33 GMT'); 31 test('Mon, 21-Nov-2008 01:03:33 GMT');
15 test('Mon, 21-Feb-2008 01:03:33 GMT'); 32 test('Mon, 21-Feb-2008 01:03:33 GMT');
16 test('Mon, 03-Feb-2008 01:03:33 GMT'); 33 test('Mon, 03-Feb-2008 01:03:33 GMT');
17 test('Mon, 3-Mar-2008 01:03:33 GMT'); 34 test('Mon, 3-Mar-2008 01:03:33 GMT');
18 </script> 35 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/misc/last-modified-parsing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698