Fix year/month reset bug in DateInput#1056
Conversation
Modified handleMonthSelection and handleYearSelection to update the internal currentDate state directly using Luxon's .set() method. This ensures that when a user selects a new year, the month is preserved, and when they select a new month, the year is preserved. Removed redundant side effects that were updating the internalValue (input selection) during picker navigation, avoiding confusing UI updates before a day is actually selected. Updated version to 3.154.2. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Ao abrir tanto a seleção de mês quanto a de ano, é exibido sempre como se apenas o mês de janeiro e o ano de 2026 estivessem selecionados, mesmo que não estejam. |
Corrigido. Agora os seletores de mês e ano não exibem mais destaques de seleção por padrão (Janeiro/2026) quando nenhuma data está selecionada ou quando a navegação está em andamento. O destaque agora reflete corretamente apenas a data selecionada. |
…reset - Fix reset of year when selecting month (and vice-versa) by using currentDate.set() instead of relying on internalValue. - Fix incorrect highlighting of January/CurrentYear in selection grids when no date is selected. - Updated Vitest snapshots for DateInput. - Updated project version to 3.154.2. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
|
O bug de reset do ano/mês foi corrigido, porém quando um ano ou mês é selecionado o item que representa esse dado no Gravacao.de.tela.de.2026-02-11.08-22-53.webm |
|
…d fix highlighting - Modified DateInput.vue to update internal currentDate state using Luxon's .set() instead of relying on formatted internalValue. - Introduced userHasNavigated state to manage picker highlights during navigation. - Updated MonthSelectorGrid and YearSelectorGrid to only highlight selected dates when a date is actually provided, avoiding default highlights for January and current year. - Added unit tests for selector grid highlighting. - Bumped version to 3.154.3. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
|
Por padrão, o mês selecionado não vem com highlight ao abrir o monthpicker, enquanto o ano vem corretamente. |
Corrigido. Agora tanto o mês quanto o ano possuem highlight por padrão ao abrir os seletores, baseando-se na data atual de visualização do calendário. Isso garante consistência entre os dois seletores. |
- Always pass current view date to Month and Year selector grids to ensure they show highlights by default. - Removed unused userHasNavigated state. - Updated DateInput snapshots. - Bumped version to 3.154.4. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
- Added docs/.docgen/components-metadata.json to .gitignore. - Removed docs/.docgen/components-metadata.json from git index. - Bumped version to 3.154.5. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
…re type checking - Moved `npm run generate:docs` before `vue-tsc` in the `build` script. - This ensures that `docs/.docgen/components-metadata.json` is generated before `vue-tsc` attempts to validate types in files that import it. - Bumped version to 3.154.6. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
|
@greptileai can you review the PR? |
Greptile OverviewGreptile SummaryFixed a critical bug where selecting a year and then a month (or vice-versa) would reset the previously selected value in the Key changes:
The fix properly leverages Luxon's Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/components/DateInput.vue | Simplified month/year selection handlers using Luxon's .set() method; replaced internalValue-based logic with currentDate-based updates |
| src/components/InternalComponents/MonthSelectorGrid.vue | Changed default return value from 1 to null when no date is selected, preventing incorrect highlighting |
| src/components/InternalComponents/YearSelectorGrid.vue | Refactored to use selectedYear from props instead of current year; properly highlights the selected year in the picker |
| src/tests/SelectorGridHighlight.spec.js | Added tests to verify correct highlighting behavior when selectedDate is empty or provided |
Sequence Diagram
sequenceDiagram
participant User
participant DateInput
participant YearPicker as YearSelectorGrid
participant MonthPicker as MonthSelectorGrid
User->>DateInput: Click year selector
DateInput->>YearPicker: Show picker with currentDate
YearPicker-->>YearPicker: Highlight selectedYear from currentDate
User->>YearPicker: Select year (e.g., 2025)
YearPicker->>DateInput: handleYearSelection(2025)
DateInput->>DateInput: currentDate.set({ year: 2025 })
Note over DateInput: currentDate updated, but internalValue unchanged
User->>DateInput: Click month selector
DateInput->>MonthPicker: Show picker with updated currentDate
MonthPicker-->>MonthPicker: Highlight selectedMonth from currentDate
User->>MonthPicker: Select month (e.g., May)
MonthPicker->>DateInput: handleMonthSelection(May)
DateInput->>DateInput: currentDate.set({ month: 5 })
Note over DateInput: Month set on already-updated year
User->>DateInput: Select day
DateInput->>DateInput: Update internalValue
DateInput-->>User: Emit formatted date
The
DateInputcomponent had a bug where selecting a year and then a month (or vice-versa) would reset the previously selected value. This was due to the handlers relying on the currently selected date string (internalValue) as a base, which didn't reflect intermediate navigation steps.I fixed this by:
currentDatestate as the base..set()method to cleanly update only the relevant part (month or year) while automatically handling day-clamping at month-ends.internalValueduring navigation, so the input text only changes when a day is actually picked.Verification:
Fixes #1055
PR created automatically by Jules for task 1088739392285522216 started by @lucasn4s