Skip to content

CupertinoDatePicker - Day of the week always in EN (locale issue) #141875

@edumolins

Description

@edumolins

Steps to reproduce

I have implemented a picker with CupertinoDatePicker to select a day within a reservation process. I need the day of the week to be displayed to help the users in the booking so I have enabled the following parameter:

showDayOfWeek: true,

The issue occurs when combining this showDayOfWeek: true and this mode:

mode: CupertinoDatePickerMode.date

In this case the day of the week always displays in EN. The application supports EN, ES, and CA. One might think it's because the localizations are not properly configured, but the months appear in the correct language according to the device's locale. However, the day of the week does not. Additionally, if the mode is changed to

mode: CupertinoDatePickerMode.dateAndTime

the day of the week appears in the proper language. I am attaching screenshots.

Expected results

The day of the week should vary according to the locale, just like the language of the months changes

Actual results

The day of the week always appears in English

Code sample

I have this locale configuration in Material App of main.dart

Code sample
 supportedLocales: const [
        Locale('es'), // Spanish
        Locale('ca'), // Catalan
        Locale('en'), // English
      ],
      locale: locale,
      onGenerateRoute: (_) => SplashScreen.route(),
      localizationsDelegates: [
        widget.flutterI18nDelegate,
        GlobalCupertinoLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
      ],

That's the implementation of CupertinoDatePickerWidget. The error occurs specifically in date mode.

CupertinoDatePicker(
          mode: CupertinoDatePickerMode.date,
          showDayOfWeek: true,
          minimumDate: DateTime(now.year, now.month, now.day, 0, 0, 0, 0),
          maximumYear: DateTime.now().year + 1,
          minimumYear: DateTime.now().year,
          initialDateTime: widget.dayPicked,
          maximumDate: DateTime.now().add(const Duration(days: 365)),
          onDateTimeChanged: (datePicked) {
            widget.onDateChanged!(datePicked);
          }),

Screenshots or Video

Screenshots / Video demonstration ![ca1](https://github.com/flutter/flutter/assets/1089537/838a2d73-4f66-4b88-a83d-dabca468cad7) ![es1](https://github.com/flutter/flutter/assets/1089537/0ee7c2d0-b641-429e-9fd8-3b9bddcc25f8) ![ok1](https://github.com/flutter/flutter/assets/1089537/cd1177a2-89ed-427c-a6b9-26a8cf99400a)

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.5, on macOS 12.6.9 21G726 darwin-x64, locale es-ES)
    • Flutter version 3.13.5 on channel stable at /Users/edumolins/Desktop/flutter_313
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (4 months ago), 2023-09-19 13:56:11 -0700
    • Engine revision bd986c5ed2
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at /Users/edumolins/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] Connected device (3 available)
    • 2306EPN60G (mobile) • 4P4PNVOZBUM7QOVO • android-arm64  • Android 14 (API 34)
    • macOS (desktop)     • macos            • darwin-x64     • macOS 12.6.9 21G726 darwin-x64
    • Chrome (web)        • chrome           • web-javascript • Google Chrome 120.0.6099.234

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)f: cupertinoflutter/packages/flutter/cupertino repositoryf: date/time pickerDate or time picker widgetsfound in release: 3.16Found to occur in 3.16found in release: 3.19Found to occur in 3.19frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions