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

feat(intl): allow abbreviated months not strictly being title cased (MMM, LLL) #817

Open
alestiago opened this issue Mar 23, 2024 · 5 comments
Labels
P4 A feature or bug we're unlikely to address package:intl type-enhancement A request for a change that isn't a bug

Comments

@alestiago
Copy link

alestiago commented Mar 23, 2024

Describe the bug

The abbreviated month (LLL, MMM) has to be title cased for it to be parsed adequately.

I'm not sure if this is intended, but I think it would improve the overall developer experience if the casing didn't affect the output of the parse.

import 'package:intl/intl.dart' as intl; // ^0.19.0

void main() {
  final formatter = intl.DateFormat.LLL();
  final date1 = formatter.parse('Mar');
  print(date1); // 1970-03-01 00:00:00.000

  final date2 = formatter.parse('mar');
  print(date2); // FormatException: Trying to read LLL from mar at 0
}
@alestiago alestiago added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 23, 2024
@alestiago alestiago changed the title feat(intl): allow abbreviated months not strictly being title cased (MMM, LLL) feat(intl): allow abbreviated months not strictly being titlecased (MMM, LLL) Mar 23, 2024
@alestiago alestiago changed the title feat(intl): allow abbreviated months not strictly being titlecased (MMM, LLL) feat(intl): allow abbreviated months not strictly being title cased (MMM, LLL) Mar 23, 2024
@mosuem
Copy link
Member

mosuem commented Apr 2, 2024

This is another reason why parsing is considered fragile, and will not be a feature of the upcoming package:intl4x.

@mosuem mosuem added type-enhancement A request for a change that isn't a bug P4 A feature or bug we're unlikely to address package:intl and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Apr 2, 2024
@alestiago
Copy link
Author

alestiago commented Aug 13, 2024

@mosuem are there any plans to deprecate the intl package in favour of intl4x in the future? If so is there a road-map to track the progress?

@mosuem
Copy link
Member

mosuem commented Aug 13, 2024

We will deprecate intl as soon as intl4x is stable on all platforms - and that might take a while.

Good question about the roadmap. I should set up a tracking issue somewhere. The general idea is that we are wrapping a Rust library, so we need the ability to ship native assets, and tree-shake them, as well as include the .postcard data assets. So still some work to do. The story on the web is much cleaner, as we just expose the browsers Intl object, this is largely done.

@alestiago
Copy link
Author

Thanks @mosuem for the insights! I'm looking forward to it being stable on all platforms (I'll imagine the community is too).

Out of curiosity, what motivated the development of intl4x over the continuation of intl?

@mosuem
Copy link
Member

mosuem commented Aug 14, 2024

intl is a pretty old library with a limited set of features. It must be maintained, bugs must be fixed, some of which are hard to fix (e.g., the data is stored in Dart tables, which makes them un-treeshakeable).

With intl4x, we hope to reduce maintenance while getting more features with less data size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 A feature or bug we're unlikely to address package:intl type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants