diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-12-03 08:53:51 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-12-03 08:53:51 -0500 |
| commit | 38dc473ddd6494ad5b60062b757f8d11009a7886 (patch) | |
| tree | d01f9a7d7bf6fa49db2512e69b6c880d79392c3e | |
| parent | 89ade3c9f048bbda108948d89de3c2b9c0d4a0ed (diff) | |
fixed blog check date and also internationlized "new post" text
| -rw-r--r-- | www/js/NewsCtrl.js | 4 | ||||
| -rw-r--r-- | www/js/app.js | 19 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 1 |
3 files changed, 17 insertions, 7 deletions
diff --git a/www/js/NewsCtrl.js b/www/js/NewsCtrl.js index 39782226..f6709320 100644 --- a/www/js/NewsCtrl.js +++ b/www/js/NewsCtrl.js @@ -58,7 +58,7 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro var mItemDate = moment(itemdate); //var unread = mItemDate.diff(mLastDate) >0) ? true:false; //console.log (unread); - return (mItemDate.diff(mLastDate) > 0) ? true : false; + return (mItemDate.diff(mLastDate, 'seconds') > 0) ? true : false; }; @@ -80,7 +80,7 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro var mLastDate = moment(lastDate); var mItemDate = moment(itemdate); - if (mItemDate.diff(mLastDate) > 0) + if (mItemDate.diff(mLastDate, 'seconds') > 0) { NVRDataModel.debug("Updating lastDate to this post"); diff --git a/www/js/app.js b/www/js/app.js index 34958cbc..ad474df8 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -633,7 +633,7 @@ angular.module('zmApp', [ //----------------------------------------------------------------- // This service automatically checks for new versions every 24 hrs //------------------------------------------------------------------ -.factory('zmCheckUpdates', function($interval, $http, zm, $timeout, $localstorage, NVRDataModel, $rootScope) +.factory('zmCheckUpdates', function($interval, $http, zm, $timeout, $localstorage, NVRDataModel, $rootScope, $translate) { var zmUpdateHandle; var zmUpdateVersion = ""; @@ -726,18 +726,27 @@ angular.module('zmApp', [ if (!lastDate) { - $rootScope.newBlogPost = "(new post)"; + $rootScope.newBlogPost = "("+$translate.instant('kNewPost')+")"; + NVRDataModel.setLatestBlogPostChecked(moment().format("YYYY-MM-DD HH:mm:ss")); return; } var mLastDate = moment(lastDate); var mItemDate = moment(data.payload.posts[0].createdAt); - if (mItemDate.diff(mLastDate) > 0) + if (mItemDate.diff(mLastDate, 'seconds') > 0) { - NVRDataModel.debug("New post dated " + mItemDate.format("YYYY-MM-DD HH:mm:ss") + " found"); + /*console.log ("DIFF IS "+mItemDate.diff(mLastDate, 'seconds')); + console.log ("DIFF mLastDate="+mLastDate); + console.log ("DIFF mItemDate="+mItemDate); + console.log ("FORMAT DIFF mLastDate="+mLastDate.format("YYYY-MM-DD HH:mm:ss") ); + console.log ("FORMAT DIFF mItemDate="+mItemDate.format("YYYY-MM-DD HH:mm:ss") );*/ + + NVRDataModel.debug("New post dated " + mItemDate.format("YYYY-MM-DD HH:mm:ss") + " found, last date checked was "+mLastDate.format("YYYY-MM-DD HH:mm:ss")); - $rootScope.newBlogPost = "(new post)"; + $rootScope.newBlogPost = "("+$translate.instant('kNewPost')+")"; + NVRDataModel.setLatestBlogPostChecked(mItemDate.format("YYYY-MM-DD HH:mm:ss")); + } diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index 67ad0ca4..951edb38 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -208,6 +208,7 @@ "kNeedToKnow" :"I need to know your ZoneMinder login and path details to get started", "kNegotiatingStreamAuth" :"negotiating stream authentication", "kNews" :"News (latest 10)", + "kNewPost" : "new post", "kNext" :"Next", "kNextEvent" :"next event", "kNextMonitor" :"next monitor", |
