Skip to content

Commit

Permalink
🐛 Bandemonium hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ironman5366 committed Apr 21, 2019
1 parent 68841cc commit 77cd3dc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# KRLX Desktop [![Build Status](https://travis-ci.org/ironman5366/KRLXDesktop.svg?branch=master)](https://travis-ci.org/ironman5366/KRLXDesktop)
A desktop app for [KRLX](http://www.krlx.org/), written in Electron
![Screenshot]: (https://imgur.com/m8YdQyy)

## Features:
- Displays current show and information, pulling host info from Carleton directory
Expand Down
35 changes: 33 additions & 2 deletions page.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,29 @@ function get_song_widget(song){
function get_show_widget(show, hosts){
let start_d = new Date();
let end_d = new Date();
if (!show.start){
show.start = "17:00"
}
if (!show.end){
show.end = "19:00"
}
if (!show.day){
show.day = start_d.getDay();
}
if (!show.description){
show.description = "No description found";
}
//[year, month, day, hour, minute, second, millisecond]
let start_split = show.start.split(":");
start_d.setHours(start_split[0], start_split[1]);
let end_split = show.end.split(":");
end_d.setHours(end_split[0], end_split[1]);
let start = moment(start_d);
let end = moment(end_d);
let remaining = end.toNow();
let remaining = end.fromNow();
if (remaining.includes("ago")){
remaining = end.toNow();
}
let card = "<div class=\"card\">\n" +
" <div class=\"card-body\">\n" +
" <h4 class=\"card-title\">"+show.title+"</h4>\n" +
Expand All @@ -159,13 +174,29 @@ function get_upcoming_widget(show){
let start_d = new Date();
let end_d = new Date();
//[year, month, day, hour, minute, second, millisecond]
// Fix bandemonium start end
if (!show.start){
show.start = "17:00"
}
if (!show.end){
show.end = "19:00"
}
if (!show.day){
show.day = start_d.getDay();
}
if (!show.description){
show.description = "No description found";
}
let start_split = show.start.split(":");
start_d.setHours(start_split[0], start_split[1]);
let end_split = show.end.split(":");
end_d.setHours(end_split[0], end_split[1]);
let start = moment(start_d);
let end = moment(end_d);
let until = start.toNow();
let until = start.fromNow();
if (until.includes("ago")){
until = start.toNow();
}
let widget = "<div class='card mb-3'>";
widget += "<div><div class='card-header'>" +
" <h5 class=\"card-title\">"+show.title+"</h5>\n" +
Expand Down

0 comments on commit 77cd3dc

Please sign in to comment.