Skip to content

Commit

Permalink
final date and room tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramoore committed Apr 4, 2023
1 parent 90bb610 commit 8be7a43
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gwcc_export.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
row.push('"' + s["title"] + '"')
row.push('"' + formatDate(s["startsAt"]) + '"')
row.push('"' + formatDate(s["endsAt"]) + '"')
row.push('"A' + room + '"')
row.push('"' + room + '"')
//console.log([row, s])
csvData.push(row.join(","))
})
Expand All @@ -72,11 +72,15 @@
}
}
function formatDate(datestr) {
return new Date(datestr).toLocaleString();;
const date = new Date(datestr);
const datePart = date.toLocaleString("en-us", {month: "numeric",day: "numeric",year: "numeric"});
const timePart = date.toLocaleString("en-us", {hour12: true, hour: "2-digit",minute: "2-digit"});
return datePart+ " " +timePart
}
function formatRoom(roomStr) {
if(roomStr.includes('Sydney Marcus')) return 'Sydney Marcus';
const number = roomStr.match(/\d+/g);
if(number) return number[0];
if(number) return "A" + number[0];
else return null;
}
function downloadObjectAsJson(exportObj, exportName) {
Expand Down

0 comments on commit 8be7a43

Please sign in to comment.