Skip to content

Conversation

Copy link

Copilot AI commented Oct 27, 2025

Date input parsing in datagrid fields ignored the user's configured date format (e.g., D/M/Y) and always used locale-based parsing (M/D/Y for en-US). Typing "2/9/2025" with D/M/Y format selected September 2nd in the UI but parsed as February 9th.

Changes

Modified parseDateTimeStr() in date_time_text_field.dart

  • Parse using configured date format pattern first (strict then lenient)
  • Handle date+time combined formats when includeTime is enabled
  • Fall back to AnyDate for natural language input ("tomorrow", etc.)

Added test coverage

  • Test case verifying DayMonthYear, US, and Local format parsing
  • Validates "2/9/2025" → Sept 2 for D/M/Y, Feb 9 for M/D/Y

Example

// Before: always used locale-based parsing
final parser = AnyDate.fromLocale(locale);
final result = parser.tryParse(string);

// After: respects configured format
try {
  return dateFormat.parseStrict(trimmedString); // e.g., dd/MM/y
} catch (_) {
  // Fall back to lenient parsing, date+time formats, then AnyDate
}

Maintains backward compatibility with natural language dates and all existing date format patterns (Local, US, ISO, Friendly, DayMonthYear).

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] Date format not respected in date type for datagrid</issue_title>
<issue_description>### Bug Description

My AppFlowy app is set to D/M/Y format. When I type in the date 2/9/2025 in a datagrid date field, it selects February 9th, 2025, not September 2nd, 2025. The format in the input seems to be forced M/D/Y. It only works correctly if the D portion is above 12.

How to Reproduce

Try putting a date into a date field that uses a day and month below 12.

Expected Behavior

Respect the Date format I've selected for the app.

Operating System

MacOS

AppFlowy Version(s)

10.0.2

Screenshots

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@LucasXu0 It can be reproduced in the latest version.

Image</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 3 commits October 27, 2025 01:45
Co-authored-by: LucasXu0 <11863087+LucasXu0@users.noreply.github.com>
Co-authored-by: LucasXu0 <11863087+LucasXu0@users.noreply.github.com>
Co-authored-by: LucasXu0 <11863087+LucasXu0@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix date format inconsistency in datagrid Fix date parsing to respect user's configured date format in datagrid Oct 27, 2025
Copilot AI requested a review from LucasXu0 October 27, 2025 01:53
@LucasXu0 LucasXu0 closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Date format not respected in date type for datagrid

3 participants