How to change the locale startOfweek ? #272
-
Thanks for awesome Package!😍 It's made my life easier. I'm only struggling about how to change localeStartOfWeek manually. //Getting default Start Date of Week
var defaultStartOfWeek = Jiffy.now().localeStartOfWeek;
print(defaultStartOfWeek); //StartOfWeek.sunday
//Trying to change Start Date of Week manually
defaultStartOfWeek = StartOfWeek.monday;
var xyz = Jiffy.now();
//Expected Output= StartOfWeek.monday
print(xyz.localeStartOfWeek); //StartOfWeek.sunday
Here in this snippet, expecting So, why i need this as user can get startOfWeek by their locale?If user want to change First date of week manually. So how to change |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @abdullah-cse Glad you like And yes, we should have a way to manually set the start day of week, since its really in demand Will work on it, and see how first I can ship this feature out |
Beta Was this translation helpful? Give feedback.
-
As of version 6.4.0, you can now override locale settings So to override the start of week, simply do the following await Jiffy.setLocale(locale: 'en_US');
final jiffy = Jiffy.now().locale.startOfWeek; // Sunday
// Overriding the start of week
await Jiffy.setLocale(
locale: 'en_US',
startOfWeek: StartOFWeek.saturday,
);
final jiffy = Jiffy.now().locale.startOfWeek; // Saturday |
Beta Was this translation helpful? Give feedback.
As of version 6.4.0, you can now override locale settings
So to override the start of week, simply do the following