Skip to content

Commit

Permalink
πŸ› Fixes (i think) date parsing for Safari users in holidays widget (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed May 9, 2024
1 parent b97ba74 commit 72d2f1b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/Widgets/PublicHolidays.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ export default {
/* Assign data variables to the returned data */
processData(holidays) {
const results = [];
const makeDate = (date) => timestampToDate(
new Date(`${date.year}-${date.month}-${date.day}`).getTime(),
);
const makeDate = (date) => {
const formattedMonth = date.month.toString().padStart(2, '0'); // Ensure two digits
const formattedDay = date.day.toString().padStart(2, '0'); // Ensure two digits
const dateString = `${date.year}-${formattedMonth}-${formattedDay}T00:00:00`;
return timestampToDate(new Date(dateString).getTime());
};
const formatType = (ht) => capitalize(ht.replaceAll('_', ' '));
holidays.forEach((holiday) => {
results.push({
Expand Down

0 comments on commit 72d2f1b

Please sign in to comment.