Not updating new Date in Svelte
When you change the date in reactive mode, it does not change. Maybe it’s a bug, maybe a feature. But we need everything to change. How to do it.
Date code:
let currentDate;
const options = {weekday: ‘long’, year: ‘numeric’, month: ‘short’, day: ‘numeric’};
The place where it should change when it changes:
I did not find a solution through the front, as an option to transfer through the backend and process:
postFetch(‘get-date/’, data).then((r) => {
currentDate = r[‘current_date’]
currentDate = new Date(currentDate).toLocaleDateString(‘ru-RU’, options);
});
At the output we get:
Saturday, Oct 23 2030