Merge branch 'master' of bitbucket.org:jubilian/nhance_partner
This commit is contained in:
commit
25d9e1d0dd
@ -1261,9 +1261,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
|||||||
return "Select start date first";
|
return "Select start date first";
|
||||||
}
|
}
|
||||||
|
|
||||||
final startDate = DateFormat(
|
final startDate = DateFormat('dd-MM-yyyy').parse(startDateControllerText);
|
||||||
'dd-MM-yyyy',
|
|
||||||
).parse(startDateControllerText);
|
|
||||||
final endDate = DateFormat('dd-MM-yyyy').parse(value);
|
final endDate = DateFormat('dd-MM-yyyy').parse(value);
|
||||||
|
|
||||||
if (endDate.isBefore(startDate)) {
|
if (endDate.isBefore(startDate)) {
|
||||||
@ -1275,7 +1273,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
|||||||
startDate.year + 1,
|
startDate.year + 1,
|
||||||
startDate.month,
|
startDate.month,
|
||||||
startDate.day,
|
startDate.day,
|
||||||
);
|
).subtract(const Duration(days: 1));
|
||||||
|
|
||||||
if (endDate.isBefore(minEndDate)) {
|
if (endDate.isBefore(minEndDate)) {
|
||||||
return "End date must be at least 1 year from start date";
|
return "End date must be at least 1 year from start date";
|
||||||
|
|||||||
@ -40,9 +40,13 @@ class _ThemedDateFieldState extends State<ThemedDateField> {
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
FormFieldState<String> field,
|
FormFieldState<String> field,
|
||||||
) async {
|
) async {
|
||||||
|
DateTime initialDate = selectedDate ??
|
||||||
|
(widget.controller?.text.isNotEmpty == true
|
||||||
|
? DateFormat('dd-MM-yyyy').parse(widget.controller!.text)
|
||||||
|
: DateTime.now());
|
||||||
final pickedDate = await showDatePicker(
|
final pickedDate = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: selectedDate ?? DateTime.now(),
|
initialDate: initialDate,
|
||||||
firstDate: DateTime(2000),
|
firstDate: DateTime(2000),
|
||||||
// lastDate: DateTime(2100),
|
// lastDate: DateTime(2100),
|
||||||
lastDate: widget.lastDate ?? DateTime(2100),
|
lastDate: widget.lastDate ?? DateTime(2100),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user