jama5262 / jiffy

Jiffy is a Flutter (Android, IOS and Web) date time package for parsing, manipulating, querying and formatting dates
https://pub.dev/packages/jiffy
MIT License
576 stars 124 forks source link

The wrong locale data while there are parsing data through endOf function #241

Closed klnfreedom closed 1 year ago

klnfreedom commented 1 year ago

jiffy: ^6.1.0

Describe the bug

I am having trouble identifying the correct first day of the week. It seems that the library does not support my current locale, so it defaults to EnUsLocale(). However, I've noticed that the first day of the week in this locale is Sunday, which may not be the case for all users. For example, in my time zone, the first day of the week is actually Monday.

How to reproduce the bug

final today = Jiffy.now();
final end = today.endOf(Unit.week).dateTime;

What is the expected behavior

Correctly determining the weekdays for the current locale.

Screenshots lib -> src -> jiffy.dart -> 218 row image

lib -> src -> manipulator.dart -> 139 row image

jama5262 commented 1 year ago

Similar to #64

jama5262 commented 1 year ago

Please follow the issue linked above, since its related, working on making the start of week configurable and also lets users to create their own custom locales, so that they are not limited only Jiffy locales