Jump to today, and open a period on the dates it actually has
The month can now be reached in one click instead of paging back through the year. The button sits left of the month dropdown and sizes to its label, so Idag and Today both fit. Opening a period showed the wish's first year rather than the occurrence that was clicked: a 2028 week of a yearly wish opened on 2026, and a flexible period opened on its bounding range instead of where the planner put it. The popover now prefills from the clicked band's own dates. Saving a yearly wish keeps its anchor year, since the edited dates describe the recurring pattern and not one occurrence — moving a single year is a separate choice that does not exist yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ei7gCZzdd751uZtPzb1Pep
This commit is contained in:
@@ -591,6 +591,19 @@ export function Calendar(): ReactNode {
|
||||
const start = splitISODate(payload.startDate)
|
||||
const end = splitISODate(payload.endDate)
|
||||
|
||||
// The popover now prefills from the *clicked* occurrence's real placed
|
||||
// dates (see PeriodPopover's `formStateFromWish`), so `payload.startDate`
|
||||
// may carry a later year than the wish's `firstYear` — e.g. clicking a
|
||||
// 2028 occurrence of a wish first taken in 2026. For a yearly wish, the
|
||||
// anchor year must stay put: writing `firstYear: 2028` here would
|
||||
// silently drop the 2026/2027 occurrences, and this popover has no
|
||||
// "this occurrence only" concept (yet — a later change adds that choice
|
||||
// explicitly). So only the recurring window's month/day come from the
|
||||
// edited dates; the anchor year is preserved unless recurrence is being
|
||||
// set to 'once', where there is exactly one occurrence and its year
|
||||
// *is* the edited date's year.
|
||||
const firstYear = payload.recurrence === 'yearly' ? previousWish.firstYear : start.year
|
||||
|
||||
try {
|
||||
setIsPeriodSaving(true)
|
||||
setPeriodError(null)
|
||||
@@ -601,7 +614,7 @@ export function Calendar(): ReactNode {
|
||||
windowStartDay: start.day,
|
||||
windowEndMonth: end.month,
|
||||
windowEndDay: end.day,
|
||||
firstYear: start.year,
|
||||
firstYear,
|
||||
recurrence: payload.recurrence,
|
||||
lastYear: payload.recurrence === 'yearly' ? payload.lastYear : null,
|
||||
parentMode: payload.parentMode,
|
||||
@@ -799,6 +812,13 @@ export function Calendar(): ReactNode {
|
||||
←
|
||||
</button>
|
||||
<h2 className="calendar__title">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn--ghost calendar__today-button"
|
||||
onClick={() => setCurrentMonth(new Date())}
|
||||
>
|
||||
{t('calendar.today')}
|
||||
</button>
|
||||
<select
|
||||
value={month}
|
||||
onChange={handleMonthChange}
|
||||
|
||||
Reference in New Issue
Block a user