FIX: correctly display single digit event in safari (#756)

We were building the list of events by using the non padded day as key, eg:

```
{ 3: { ... }, 16: { ... } }
```

Which we would then use to construct a date and would end up doing something like:

```
moment("2025-07-3").format()
```

It was working in most browsers, but safari was not accepting it and would display an `invalid date` error.

The fix is using a padded day as key that will ensure consistent behavior.

No test as it's browser specific behavior.
This commit is contained in:
Joffrey JAFFEUX 2025-06-25 23:05:14 +02:00 committed by GitHub
parent 0162ed5797
commit 811a729d19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ const DEFAULT_UPCOMING_DAYS = 180;
const DEFAULT_COUNT = 8;
function addToResult(date, item, result) {
const day = date.date();
const day = date.format("DD");
const monthKey = date.format("YYYY-MM");
result[monthKey] = result[monthKey] ?? {};