changes to calendar

This commit is contained in:
Sajal Sharma
2017-10-07 01:18:35 -07:00
parent 1b6867ca1c
commit 45dc306132
+18 -6
View File
@@ -1,28 +1,37 @@
console.log("hey");
function getInformation(information)
{
var elements = information.split(" ")[];
var elements = information.split(" ");
console.log(elements);
date = elements[1];
console.log(date);
datePortion = "20" + date.substring(6) + "-" + date.substring(0, 2) + "-" + date.substring(3, 5);
console.log(datePortion);
militaryTime = true;
for (var x = 0; x < elements.length(), x++)
for (var i = 0; i < elements.length; i++)
{
if elements[x].toLowerCase() == "pm" || elements[x].toLowerCase() == "am"
if (elements[i].toLowerCase() === "pm" || elements[i].toLowerCase() === "am")
{
militaryTime = false;
}
}
console.log(militaryTime);
timePortion1 = "";
timePortion2 = "";
if isMilitaryTime
if (militaryTime)
{
timePortion1 = elements[2] + ":00-07:00";
timePortion2 = elements[3] + ":00-07:00";
console.log(timePortion1);
console.log(timePortion2);
}
else
{
if elements[2].substring(5).toLowerCase() == "am"
if (elements[2].substring(5).toLowerCase() === "am")
{
timePortion1 = elements[2].substring(0, 5) + ":00-07:00";
}
@@ -32,7 +41,7 @@ function getInformation(information)
timePortion1 = hour + elements[2].substring(2, 5);
}
if elements[3].substring(5).toLowerCase() == "am"
if (elements[3].substring(5).toLowerCase() === "am")
{
timePortion2 = elements[3].substring(0, 5) + ":00-07:00";
}
@@ -42,6 +51,7 @@ function getInformation(information)
timePortion2 = hour + elements[3].substring(2, 5);
}
}
console.log([elements[0], datePortion + "T" + timePortion1, datePortion + "T" + timePortion2]);
return [elements[0], datePortion + "T" + timePortion1, datePortion + "T" + timePortion2];
}
@@ -86,3 +96,5 @@ function makeEvent(information)
appendPre('Event created: ' + event.htmlLink);
});
}
getInformation("Bob's 01/24/24 12:33AM 1:23AM");