fix yesterday labels

This commit is contained in:
Luke Pulverenti 2016-08-25 00:53:12 -04:00
parent 870c5e2f2d
commit 06f03fdbf3
5 changed files with 22 additions and 12 deletions

View File

@ -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",

View File

@ -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
};
});

View File

@ -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"
}

View File

@ -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);

View File

@ -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);