Fix history timeline legend selection. (#276)

pull/279/head
Andrey 2017-05-10 08:49:01 +03:00 committed by Paulus Schoutsen
parent 82a6b06cfb
commit c0f119c853
2 changed files with 8 additions and 6 deletions

View File

@ -123,11 +123,12 @@
}
daysDelta = (endTime - startTime) / (24 * 3600 * 1000);
if (daysDelta > 30) {
// Avoid rounding up when the API returns a few extra seconds.
if (daysDelta > 30.1) {
options.hAxis.format = 'MMM d';
} else if (daysDelta > 3) {
} else if (daysDelta > 3.1) {
options.hAxis.format = 'EEE, MMM d';
} else if (daysDelta > 1) {
} else if (daysDelta > 1.1) {
options.hAxis.format = 'EEE, MMM d, H:mm';
}

View File

@ -90,11 +90,12 @@ Polymer({
}
format = 'H:mm';
daysDelta = (endTime - startTime) / (24 * 3600 * 1000);
if (daysDelta > 30) {
// Avoid rounding up when the API returns a few extra seconds.
if (daysDelta > 30.1) {
format = 'MMM d';
} else if (daysDelta > 3) {
} else if (daysDelta > 3.1) {
format = 'EEE, MMM d';
} else if (daysDelta > 1) {
} else if (daysDelta > 1.1) {
format = 'EEE, MMM d, H:mm';
}