Skip to content

Parsing of dates in "ar" locale fails when typed #852

@jokraft

Description

@jokraft

Describe the bug
There is a problem with parsing type dates in "ar" locale (see: flutter/flutter#138635)

To Reproduce
see examples in flutter/flutter#138635
Alternatively:

import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';

void main() {
  initializeDateFormatting("ar");
  // works
  DateFormat('yMd', "ar").parseStrict(String.fromCharCodes(
      [1633, 1633, 8207, 47, 1633, 1633, 8207, 47, 1634, 1632, 1632, 1633]));
  // fails (codeUnits of typed date)
  try {
    DateFormat('yMd', "ar").parseStrict(String.fromCharCodes(
        [1633, 1633, 47, 1633, 1633, 47, 1634, 1632, 1632, 1633]));
  } catch (e) {
    print(e);
  }
}

Did some digging and my current theory is, that date_time_patterns.dart contains some unneeded "RLM" characters. Are they supposed to be generated there?
If I change keyboard to arabic and type the date there will be no such characters and as such parsing fails.

System Info Dart SDK 3.5.0-277.0.dev Flutter SDK 3.23.0-13.0.pre.277 flutter_personal_test 0.0.0

dependencies:

  • flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
  • flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]

dev dependencies:

  • file 7.0.0 [meta path]

transitive dependencies:

  • characters 1.3.0
  • clock 1.1.1
  • collection 1.18.0
  • intl 0.19.0 [clock meta path]
  • material_color_utilities 0.11.1 [collection]
  • meta 1.15.0
  • path 1.9.0
  • sky_engine 0.0.99
  • vector_math 2.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestpackage:intltype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions