cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [5/6] docs commit: Better way to handle dates across browsers
Date Wed, 12 Aug 2015 08:04:00 GMT
Better way to handle dates across browsers


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/0b5764ff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/0b5764ff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/0b5764ff

Branch: refs/heads/cordova-website
Commit: 0b5764ffb2d23e7ad93a2eaf37370cc5506eebd2
Parents: 98aa888
Author: Raghav Katyal <rakatyal@microsoft.com>
Authored: Tue Aug 11 17:23:12 2015 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Wed Aug 12 01:00:45 2015 -0700

----------------------------------------------------------------------
 www/blog/index.html    |  2 +-
 www/static/js/index.js | 13 +++----------
 2 files changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/0b5764ff/www/blog/index.html
----------------------------------------------------------------------
diff --git a/www/blog/index.html b/www/blog/index.html
index f763f5f..3d7892e 100644
--- a/www/blog/index.html
+++ b/www/blog/index.html
@@ -18,7 +18,7 @@ title: Apache Cordova Blog
               {% for post in site.posts %}
               <li>
                 <header>
-                  <div class="adorner" blogTime="{{ post.date }}"></div>
+                  <div class="adorner" blogTime="{{ post.date | date_to_rfc822 }}"></div>
                   <div>
                     <div class="title"><a href="{{ site.baseurl }}{{ post.url }}">{{
post.title }}</a></div>
                     <div>

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/0b5764ff/www/static/js/index.js
----------------------------------------------------------------------
diff --git a/www/static/js/index.js b/www/static/js/index.js
index ad46691..54ce691 100644
--- a/www/static/js/index.js
+++ b/www/static/js/index.js
@@ -74,24 +74,17 @@ function getCookie(cname) {
     return "";
 }
 
-function getTimeFromDateTime(dateTime) {
-    var date_value = dateTime.substr(0,10);
-    date_value = date_value.replace(/-/g,'/');
-    var time_value = dateTime.substr(10);
-    return new Date(date_value + time_value).getTime();
-}
-
 var lastVisit = getCookie("visitTime");
 function checkNotification() {
     var dates = [];
     if (lastVisit != "") {
         {% for post in site.posts %}
-            dates.push('{{ post.date }}');
+            dates.push('{{ post.date | date_to_rfc822 }}');
         {% endfor %}
     }
     var new_blog_count = 0;
     for(var i = 0; i < dates.length ; i++) {
-        var blog_time = getTimeFromDateTime(dates[i]);
+        var blog_time = new Date(dates[i]).getTime();
         if(blog_time > lastVisit) {
             new_blog_count++;
         }
@@ -110,7 +103,7 @@ document.getElementById("blog_button").onclick = function() {
 $(document).ready(function () {
 
     $('.adorner').each(function(i) {
-        var blog_time = getTimeFromDateTime($(this).attr('blogTime'));
+        var blog_time = new Date($(this).attr('blogTime')).getTime();
         if(blog_time > lastVisit) {
             this.style.backgroundColor = "#3992ab";
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message