Fix wrong month shown for different system date formats

This commit is contained in:
Lim Chee Aun 2023-12-29 14:27:43 +08:00
parent f21a65da9a
commit 2240380f68

View file

@ -377,14 +377,14 @@ function AccountStatuses() {
}
: {},
);
const [year, month] = value.split('-');
const monthIndex = parseInt(month, 10) - 1;
const date = new Date(year, monthIndex);
showToast(
`Showing posts in ${new Date(value).toLocaleString(
'default',
{
month: 'long',
year: 'numeric',
},
)}`,
`Showing posts in ${date.toLocaleString('default', {
month: 'long',
year: 'numeric',
})}`,
);
}}
/>