Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix :Locale bug with ShadDatePicker.range #270

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "4cf269e36de2573851eaef3c763994f8f9be494d"
revision: "68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3"
channel: "stable"

project_type: app
Expand All @@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
- platform: web
create_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
base_revision: 4cf269e36de2573851eaef3c763994f8f9be494d
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: windows
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3

# User provided section

Expand Down
8 changes: 3 additions & 5 deletions lib/src/components/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,13 @@ class _ShadDatePickerState extends State<ShadDatePicker> {
String defaultDateRangeFormat(ShadDateTimeRange range, Locale locale) {
if (range.start == null) return '';
final buffer = StringBuffer();

final start = intl.DateFormat.yMMMd(locale).format(range.start!);
final start =
intl.DateFormat.yMMMd(locale.languageCode).format(range.start!);
Copy link
Owner

@nank1ro nank1ro Jan 27, 2025

Choose a reason for hiding this comment

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

replace locale.languageCode() to locale.toLanguageTag()

buffer.write(start);

if (range.end != null) {
final end = intl.DateFormat.yMMMd(locale).format(range.end!);
final end = intl.DateFormat.yMMMd(locale.languageCode).format(range.end!);
Copy link
Owner

@nank1ro nank1ro Jan 27, 2025

Choose a reason for hiding this comment

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

replace locale.languageCode() to locale.toLanguageTag()

buffer.write(' - $end');
}

return buffer.toString();
}

Expand Down
Loading