Index: trunk/extensions/LastModified/modules/lastmodified.js |
— | — | @@ -32,12 +32,8 @@ |
33 | 33 | var displayRange = extensionsLastModifiedGetMetaRange(); |
34 | 34 | //console.log( 'displayRange: ' + displayRange ); |
35 | 35 | |
36 | | - // Get the current Date object |
37 | | - var now = new Date(); |
38 | | - //console.log( 'now: ' + now ); |
39 | | - |
40 | 36 | // Get the current timestamp and remove the milliseconds |
41 | | - var nowStamp = parseInt( now.getTime() / 1000 ) ; |
| 37 | + var nowStamp = extensionsLastModifiedGetUtcTimeStamp(); |
42 | 38 | //console.log( 'nowStamp: ' + nowStamp ); |
43 | 39 | |
44 | 40 | // Get the difference in the time from when it was last edited. |
— | — | @@ -51,7 +47,35 @@ |
52 | 48 | // Insert the text on the web page |
53 | 49 | extensionsLastModifiedInsertHtml( lastModifiedText ); |
54 | 50 | } |
| 51 | +/** |
| 52 | + * Get the UTC Timestamp without microseconds |
| 53 | + * |
| 54 | + * @todo |
| 55 | + * - What do we need to do about timezones? |
| 56 | + * |
| 57 | + * @return integer |
| 58 | + */ |
| 59 | +function extensionsLastModifiedGetUtcTimeStamp() { |
| 60 | + |
| 61 | + // Get the current Date object |
| 62 | + var now = new Date(); |
| 63 | + //console.log( 'now: ' + now ); |
| 64 | + |
| 65 | + return parseInt( now.getTime() / 1000 ); |
55 | 66 | |
| 67 | + // Return the UTC timestamp |
| 68 | + return parseInt( |
| 69 | + Date.UTC( |
| 70 | + now.getUTCFullYear(), |
| 71 | + now.getUTCMonth(), |
| 72 | + now.getUTCDay(), |
| 73 | + now.getUTCHours(), |
| 74 | + now.getUTCMinutes(), |
| 75 | + now.getUTCSeconds() |
| 76 | + ) / 1000 |
| 77 | + ); |
| 78 | +} |
| 79 | + |
56 | 80 | /** |
57 | 81 | * Get the article history link |
58 | 82 | * |