import { Injectable } from "@angular/core";

@Injectable()
export class DateService {
    constructor() {}

    toMonthAndDay(date: string) {
        return new Date(date).toLocaleDateString([], { month: "long", day: "numeric" });
    }

    toMonthDayTime(date: string) {
        return new Date(date).toLocaleTimeString([], { month: "long", day: "numeric" });
    }
}
import { Injectable } from "@angular/core";

@Injectable()
export class DateService {
    constructor() {}

    toMonthAndDay(date: string) {
        let monthAndDay = new Date(date);
        return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()}`;
    }

    toMonthDayTime(date: string) {
        let monthAndDay = new Date(date);
        return `${monthAndDay.toLocaleDateString([], { month: "long" })} ${monthAndDay.getUTCDate()} ${monthAndDay.toLocaleTimeString()}`;
    }
}
Fix dates, they were off by 1 day because of timezones.
Fix dates, they were off by 1 day because of timezones.
