http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99543

Revision: 99543
Author:   jpostlethwaite
Date:     2011-10-11 19:39:19 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Adding in javascript code in case we need to handle timezones.

Modified Paths:
--------------
    trunk/extensions/LastModified/modules/lastmodified.js

Modified: trunk/extensions/LastModified/modules/lastmodified.js
===================================================================
--- trunk/extensions/LastModified/modules/lastmodified.js       2011-10-11 
19:38:47 UTC (rev 99542)
+++ trunk/extensions/LastModified/modules/lastmodified.js       2011-10-11 
19:39:19 UTC (rev 99543)
@@ -32,12 +32,8 @@
        var displayRange = extensionsLastModifiedGetMetaRange();
        //console.log( 'displayRange: ' + displayRange );
        
-       // Get the current Date object
-       var now = new Date();
-       //console.log( 'now: ' + now );
-       
        // Get the current timestamp and remove the milliseconds
-       var nowStamp = parseInt( now.getTime() / 1000 ) ;
+       var nowStamp = extensionsLastModifiedGetUtcTimeStamp();
        //console.log( 'nowStamp: ' + nowStamp );
 
        // Get the difference in the time from when it was last edited.
@@ -51,7 +47,35 @@
        // Insert the text on the web page
        extensionsLastModifiedInsertHtml( lastModifiedText );
 }
+/**
+ * Get the UTC Timestamp without microseconds
+ *
+ * @todo
+ * - What do we need to do about timezones?
+ *
+ * @return integer
+ */
+function extensionsLastModifiedGetUtcTimeStamp() {
+       
+       // Get the current Date object
+       var now = new Date();
+       //console.log( 'now: ' + now );
+       
+       return parseInt( now.getTime() / 1000 );
 
+       // Return the UTC timestamp
+       return parseInt( 
+               Date.UTC( 
+                       now.getUTCFullYear(),
+                       now.getUTCMonth(),
+                       now.getUTCDay(),
+                       now.getUTCHours(),
+                       now.getUTCMinutes(),
+                       now.getUTCSeconds()
+               ) / 1000
+       );
+}
+
 /**
  * Get the article history link
  *


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to