From 06f03fdbf37161ba3d700780faa4fa09954114eb Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 25 Aug 2016 00:53:12 -0400 Subject: [PATCH] fix yesterday labels --- .../emby-webcomponents/.bower.json | 8 ++++---- .../emby-webcomponents/datetime.js | 14 ++++++++++++-- dashboard-ui/bower_components/polymer/.bower.json | 8 ++++---- dashboard-ui/scripts/homeupcoming.js | 2 +- dashboard-ui/scripts/tvupcoming.js | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index eca92e1f0b..d801ee1967 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -14,12 +14,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.185", - "_release": "1.4.185", + "version": "1.4.186", + "_release": "1.4.186", "_resolution": { "type": "version", - "tag": "1.4.185", - "commit": "6654b9cfd6b703fd864f5e59004db1991a0d26be" + "tag": "1.4.186", + "commit": "58f6ba7c53f72e861456632e6c278b6d9da2bf9b" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.1", diff --git a/dashboard-ui/bower_components/emby-webcomponents/datetime.js b/dashboard-ui/bower_components/emby-webcomponents/datetime.js index 50c8fbc61f..5bf42a4937 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/datetime.js +++ b/dashboard-ui/bower_components/emby-webcomponents/datetime.js @@ -104,7 +104,7 @@ }(); function toLocaleDateString(date) { - + var currentLocale = globalize.getCurrentLocale(); return currentLocale && toLocaleTimeStringSupportsLocales ? @@ -160,10 +160,20 @@ return time; } + function isRelativeDay(date, offsetInDays) { + var yesterday = new Date(); + var day = yesterday.getDate() + offsetInDays; + + yesterday.setDate(day); // automatically adjusts month/year appropriately + + return date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date.getDate() == day; + } + return { parseISO8601Date: parseISO8601Date, getDisplayRunningTime: getDisplayRunningTime, toLocaleDateString: toLocaleDateString, - getDisplayTime: getDisplayTime + getDisplayTime: getDisplayTime, + isRelativeDay: isRelativeDay }; }); \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index 25eb84c037..bc60e6e941 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -32,14 +32,14 @@ "iron-component-page": "polymerElements/iron-component-page#^1.1.6" }, "private": true, - "homepage": "https://github.com/polymer/polymer", + "homepage": "https://github.com/Polymer/polymer", "_release": "1.6.1", "_resolution": { "type": "version", "tag": "v1.6.1", "commit": "1f197d9d7874b1e5808b2a5c26f34446a7d912fc" }, - "_source": "git://github.com/polymer/polymer.git", - "_target": "^1.1.0", - "_originalSource": "polymer/polymer" + "_source": "git://github.com/Polymer/polymer.git", + "_target": "^1.2.0", + "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/scripts/homeupcoming.js b/dashboard-ui/scripts/homeupcoming.js index 94ab1825c8..669894c425 100644 --- a/dashboard-ui/scripts/homeupcoming.js +++ b/dashboard-ui/scripts/homeupcoming.js @@ -64,7 +64,7 @@ var premiereDate = datetime.parseISO8601Date(item.PremiereDate, true); - if (premiereDate.getDate() == new Date().getDate() - 1) { + if (datetime.isRelativeDay(premiereDate, -1)) { dateText = Globalize.translate('Yesterday'); } else { dateText = LibraryBrowser.getFutureDateText(premiereDate, true); diff --git a/dashboard-ui/scripts/tvupcoming.js b/dashboard-ui/scripts/tvupcoming.js index c1e40c9c77..e15dbb8c99 100644 --- a/dashboard-ui/scripts/tvupcoming.js +++ b/dashboard-ui/scripts/tvupcoming.js @@ -66,7 +66,7 @@ var premiereDate = datetime.parseISO8601Date(item.PremiereDate, true); - if (premiereDate.getDate() == new Date().getDate() - 1) { + if (datetime.isRelativeDay(premiereDate, -1)) { dateText = Globalize.translate('Yesterday'); } else { dateText = libraryBrowser.getFutureDateText(premiereDate, true);