Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

🐛 Relative calendar shows confusing units #1302

Open
ManneG opened this issue Oct 31, 2023 · 0 comments
Open

🐛 Relative calendar shows confusing units #1302

ManneG opened this issue Oct 31, 2023 · 0 comments
Labels
type: bug Something isn't working

Comments

@ManneG
Copy link

ManneG commented Oct 31, 2023

Short description of the bug

Events page displays "next month" for event happening tomorrow. Technically correct as tomorrow is the first of November, but confusing indeed.

To Reproduce

Display event happening next month when just one day is remaining

Expected behavior

The text should say "tomorrow"

Actual behavior

The text says "next month"

Context

image

Relevant code

// frontend/functions/startAndEndDateToStringRows.ts :: line 10
const row1 = dayDiff < 1 && dayDiff > -2 // yesterday or today
      ? startDate.toRelativeCalendar()
      : startDate.toLocaleString({
        ...DateTime.DATE_MED_WITH_WEEKDAY,
        year: startDate.year !== DateTime.now().year ? 'numeric' : undefined,
      });

In the luxon library

// src/datetime.js :: line 425
for (const unit of opts.units) {
  const count = differ(unit);
  if (Math.abs(count) >= 1) {
    return format(count, unit);
  }
}

Proposed solutions

  • Write own implementation that instead of matching biggest category with a difference just handles the cases of tomorrow, today, and yesterday
  • ignore as issue is not critical
@ManneG ManneG added the type: bug Something isn't working label Oct 31, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in DWWW 2023 Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
No open projects
Status: 🆕 New
Development

No branches or pull requests

1 participant