GUI/covid-vaccine-spotter

Walgreens appointments in Illinois (suburban Chicago) showing as "Invalid DateTIme"

Closed this issue · 0 comments

This morning, appointments appeared for Walgreens stores in suburban Chicago that showed as "Invalid DateTime" on the website. In the API, they looked like this:

    "appointments": [
      {
        "time": "2021-03-27T09:30:00.000-05:00",
        "type": null,
        "vaccine_types": [],
        "appointment_types": [
          "all_doses"
        ]
      },

I think the issue is that since there's no type, this logic doesn't use the time value and tries to parse the whole appointment as a date/time (which it isn't).

normalizeAppointments(appointments) {
return appointments.map((appointment) => {
let normalized;
if (appointment.time && appointment.type) {
let { type } = appointment;
switch (type) {
case "both_doses":
type = "First Dose";
break;
case "second_dose_moderna":
type = "Second Dose Only - Moderna";
break;
case "second_dose_pfizer":
type = "Second Dose Only - Pfizer";
break;
default:
type = appointment.type;
break;
}
normalized = {
time: this.formatTime(appointment.time),
type,
};
} else if (appointment.date && appointment.type) {
normalized = {
time: this.formatDate(appointment.date),
type: appointment.type,
};
} else if (appointment.date) {
normalized = {
time: this.formatDate(appointment.date),
type: null,
};
} else {
normalized = {
time: this.formatTime(appointment),
type: null,
};
}