Skip to content

Conversation

@Allaoua9
Copy link
Contributor

@Allaoua9 Allaoua9 commented Nov 14, 2025

This PR is related to #2652

  • Backend: new DatePicker widget class with mode, min/max, placeholder, and ISO validation, exposed via InputWidgetType.
  • Frontend: DatePickerInput component (single + range) based on shadcn datepicker.
  • i18n: locale-aware formatting via getDateFnsLocale plus placeholder strings in every translation file.
  • Dependencies: add react-day-picker@^9.11.1 and date-fns@^4.1.0.

Single Date

Capture d'écran 2025-11-14 110158

Date Range :

image

Summary by cubic

Added a DatePicker input widget for chat settings with single and range modes, min/max bounds, date-only ISO values, and locale-aware display.

  • New Features

    • Backend: DatePicker widget with mode, initial/min/max, format, placeholder, ISO parsing/validation, date-only serialization, and InputWidgetType "datepicker".
    • Frontend: DatePickerInput (single and range) with calendar UI, confirm/reset for ranges, disabled days from bounds, and integration in FormInput.
    • i18n: locale mapping via date-fns and placeholders across all translations.
  • Dependencies

    • Added react-day-picker ^9.11.1 and date-fns ^4.1.0.

Written for commit cc95082. Summary will update automatically on new commits.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. backend Pertains to the Python backend. frontend Pertains to the frontend. labels Nov 14, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 25 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="frontend/src/i18n/dateLocale.ts">

<violation number="1" location="frontend/src/i18n/dateLocale.ts:27">
The localeMap misses mappings for the existing German, Italian, and Korean locales, so getDateFnsLocale() falls back to English for those users. Please add the corresponding date-fns locales (e.g., de, it, ko) to keep date formatting aligned with the translations.</violation>
</file>

<file name="backend/chainlit/input_widget.py">

<violation number="1" location="backend/chainlit/input_widget.py:380">
`datetime.fromisoformat` returns a `datetime`, which then mixes with `date` inputs (raising `TypeError` during range checks) and serializes with a time component. Use `date.fromisoformat` so the helper always returns plain dates.</violation>
</file>

<file name="frontend/src/components/ChatSettings/DatePickerInput.tsx">

<violation number="1" location="frontend/src/components/ChatSettings/DatePickerInput.tsx:27">
If an invalid ISO string is passed into the widget, new Date(...) returns an Invalid Date without throwing. That value bubbles into format(...) and toISOString(), both of which throw a RangeError, causing the picker to crash. Guard parseDate by checking isNaN(getTime()) and returning undefined when parsing fails.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@hayescode hayescode added this pull request to the merge queue Nov 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 14, 2025
@hayescode hayescode enabled auto-merge November 19, 2025 20:44
@hayescode
Copy link
Contributor

@Allaoua9 can you check the merge conflicts please

Allaoua Benchikh and others added 4 commits November 26, 2025 11:13
use date instead of datetime

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
auto-merge was automatically disabled November 26, 2025 10:51

Head branch was pushed to by a user without write access

@Allaoua9 Allaoua9 force-pushed the feat/datepicker-settings branch from 5fe341e to e15d4c3 Compare November 26, 2025 10:51
@Allaoua9
Copy link
Contributor Author

@hayescode Done !

I've also made sure the front is sending dates instead of datetimes as this was causing undesired date shifts.

@Allaoua9 Allaoua9 force-pushed the feat/datepicker-settings branch from e15d4c3 to 0107ed7 Compare November 28, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. frontend Pertains to the frontend. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants