'Flutter Spinner date picker (CupertinoDatePicker) change order/swap location
I want to use Spinner date picker but I did not find it in flutter packages I found something similar CupertinoDatePicker which works fine.
but I can't change the order of the date or dateFormat,
example the default here is month-day-year
I want to change it to day-month-year
, also to change month words September,October to numbers 9,10
I know I can do this using localization but isn't there a way to force it to change for all ?
I found DatePickerDateOrder which says :
Determines the order of the columns inside CupertinoDatePicker in date mode.
which suppose to change the order dmy → 12 | March | 1996
but I have no idea how to use it.
Solution 1:[1]
You can try flutter_cupertino_date_picker
DatePicker.showDatePicker(
context,
maxDateTime: DateTime.now(),
dateFormat:'dd-MMMM-yyyy'
);
Solution 2:[2]
It is enough to specify
dateOrder: DatePickerDateOrder.dmy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rishabh Deep Singh |
Solution 2 | cursorrux |