Skip to content

Commit

Permalink
Show weekday on multiday program times
Browse files Browse the repository at this point in the history
  • Loading branch information
Aketzu committed Jul 15, 2016
1 parent b5b3e20 commit 5431a96
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ KonOpas.Item.new = function(it) {
}
if (it.mins && (it.mins != konopas.default_duration)) {
if (s) s += ', ';
s += KonOpas.pretty_time(it.time, konopas) + ' - ' + KonOpas.pretty_time(KonOpas.time_sum(it.time, it.mins), konopas);
//Check whether (long) program continues on next day and add weekday name
if ((it.mins > 480 && KonOpas.time_sum(it.time, it.mins) < it.time) || it.mins > 1440) {
var o = { weekday: "short" };
var wdstart, wdend, day;
wdstart = KonOpas.parse_date(it.date).toLocaleDateString(konopas.lc, o);

day = new Date(KonOpas.parse_date(it.date).getTime() + it.mins * 60000);
wdend = day.toLocaleDateString(konopas.lc, o);
s += wdstart + ' ' + KonOpas.pretty_time(it.time, konopas) + ' - ' + wdend + ' ' + KonOpas.pretty_time(KonOpas.time_sum(it.time, it.mins), konopas);
} else {
s += KonOpas.pretty_time(it.time, konopas) + ' - ' + KonOpas.pretty_time(KonOpas.time_sum(it.time, it.mins), konopas);
}
}
return s;
}
Expand Down

0 comments on commit 5431a96

Please sign in to comment.