I need to get "Jun" for "June" and "Mon" for "Monday". The problem is looking up in an object of english words doesn't work if user has their language set to anything other than English.
export const shortDate = (str: any) => {
const d = new Date(str);
const dateString =
daysOfWeek[d.getDay()].toUpperCase() +
', ' +
shortMonths[d.getMonth()] +
' ' +
d.getDate() +
nth(d.getDate());
return dateString;
};
I need to get rid of the shortMonths
object and the dayOfWeek
since this will be different when user is not English speaker.