summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-04-07 16:34:34 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-04-07 16:34:34 (GMT)
commitc4e22d6740e53e837fec63ccf27cb1043982dd93 (patch)
treea57eadb8ca815e5e096c517d9d9cdef88e66b6bf /www/js
parent57f2f75270d0c067755248677217942feb8dbd3e (diff)
fix date/time parsing in specials listing
Diffstat (limited to 'www/js')
-rw-r--r--www/js/specials.js26
-rw-r--r--www/js/utils.js6
2 files changed, 25 insertions, 7 deletions
diff --git a/www/js/specials.js b/www/js/specials.js
index 668ab3e..5d8b855 100644
--- a/www/js/specials.js
+++ b/www/js/specials.js
@@ -40,10 +40,9 @@ rh.ShowList.prototype.fetch = function() {
this.request_sent = true;
self.$this.trigger('pre-update');
- $.getJSON( "/pv-export/timeslots_specials/", function(data) {
+ $.getJSON( "/pv-export/timeslots_specials.json", function(data) {
self.shows = [];
$.each(data, function(showid, showdata) {
- console.log(showdata);
var show = new rh.Show(showdata);
self.shows.push(show);
});
@@ -59,10 +58,17 @@ rh.Show = function(show) {
this.id = show.id;
this.title = show.title;
- this.pv_id = show.pv_id
- this.pv_name = show.pv_name
- this.pv_start = new Date(show.start);
- this.pv_end = new Date(show.start);
+ this.pv_id = show.pv_id;
+ this.pv_name = show.pv_name;
+ this.pv_start = "??:??";
+ this.pv_end = "??:??";
+
+ if(typeof show.pv_start !== 'undefined') {
+ this.pv_start = new Date(show.pv_start.replace("_", "T"));
+ }
+ if(typeof show.pv_end !== 'undefined') {
+ this.pv_end = new Date(show.pv_end.replace("_", "T"));
+ }
};
@@ -118,7 +124,13 @@ rh.ShowView.prototype.render = function() {
var id = $('<span>').addClass('show-start').text(this.model.id);
var pvstr = "unused";
if(this.model.pv_id >= 0) {
- pvstr = this.model.pv_id + " | " + this.model.pv_name + " (" + this.model.pv_start + " - " + this.model.pv_end + ")";
+ var start_end = format_datetime(this.model.pv_start) + " - ";
+ if(compare_date(this.model.pv_start, this.model.pv_end)) {
+ start_end += format_time(this.model.pv_end);
+ } else {
+ start_end += format_datetime(this.model.pv_end);
+ }
+ pvstr = this.model.pv_id + " | " + this.model.pv_name + " (" + start_end + ")";
}
var len = $('<span>').addClass('show-len').text(pvstr);
diff --git a/www/js/utils.js b/www/js/utils.js
index 7bd5035..c3d196f 100644
--- a/www/js/utils.js
+++ b/www/js/utils.js
@@ -113,6 +113,12 @@ function format_durationms(time) {
return h + ':' + m.pad(2) + ':' + s.pad(2) + '.' + hs;
}
+function compare_date(date1, date2) {
+ var d1 = new Date(date1).setHours(0,0,0,0);
+ var d2 = new Date(date2).setHours(0,0,0,0);
+ return d1 == d2;
+}
+
function get_rd_week(msEpoch) {
//
// This computes the current Rivendell Week based on the number