Chartjs-Format labels in Chart.js. Data form axios

0👍

Welcome, Veronica! If you don’t want to use a third-party package, I would advise working with the Date type along with the Intl.DateTimeFormat object. Once you’ve cast to Date, you can build the desired string.

post?.rates?.map(x => {
    date = new Date(x.effectiveDate);

    return new Intl.DateTimeFormat('en-US', {
        month: 'short',
        day: 'numeric',
    }).format(date);
});

0👍

Hi I think you can use moment or dayjs(same stuff and moment since its depricated suggested dayjs) for this like
post?.rates?.map((x) => moment(x.effectiveDate).format(‘the format you want))

Leave a comment