Closed NikhilKukreja26 closed 2 years ago
Could you please share a piece of your implementation?
Gaspard Merten
De : Nikhil Kukreja @.> Envoyé : Thursday, March 10, 2022 8:32:06 AM À : GaspardMerten/date_field @.> Cc : Subscribed @.***> Objet : [GaspardMerten/date_field] initial date is not greater than or equal to minimumDate (Issue #28)
Hello, I am using the latest Flutter 2.10.3 and Dart SDK is 2.16.1 and I am using the Getx State Management when I click on the date field I am getting this exception the initial date is not greater than or equal to minimumDate Thank you :)
— Reply to this email directly, view it on GitHubhttps://github.com/GaspardMerten/date_field/issues/28, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJE35OH5N3QBPQSJHDGZ7KLU7GQPNANCNFSM5QLYXCYA. You are receiving this because you are subscribed to this thread.Message ID: @.***>
SizedBox( height: 58, child: DateTimeFormField( decoration: const InputDecoration( hintStyle: TextStyle(color: Colors.black45), errorStyle: TextStyle(color: primaryColor), border: OutlineInputBorder(), fillColor: primaryColor, suffixIcon: Icon( Icons.calendartoday, ), labelText: 'Start Date', ), initialValue: DateTime.parse( .habitsGetEntity.value.habit!.startDate!, ), dateFormat: DateFormat('dd/MM/yyyy'), firstDate: DateTime.now(), mode: DateTimeFieldPickerMode.date, autovalidateMode: AutovalidateMode.always, validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, onDateSelected: (DateTime value) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); final String formatted = formatter.format(value); if (kDebugMode) { print(formatted); } return _.setStartDate(formatted); }, ), ),
initial date 2022-03-10 00:00:00.000 is not greater than or equal to minimumDate 2022-03-10 12:56:39.317014 Failed assertion: line 301 pos 7: 'mode != CupertinoDatePickerMode.date || minimumDate == null || !minimumDate!.isAfter(this.initialDateTime)'
Here is the exception it is also telling me the relevant widget causing is GetMaterialApp because I am using as state management It is occurring because of that? Can you please let me know Thank you :)
The exception tells you that you should change the firstDate argument. I don't know what value _.habitsGetEntity.value.habit!.startDate!, returns but from what I can see I suggest that you try changing firstDate: DateTime.now() to firstDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
There is of course a cleaner way of doing what I just wrote :).
Does that help you ?
Thank you so much @GaspardMerten it really helped me. I am closing this issue now. God bless you man and really thank you so much :)
Hello, I am using the latest Flutter 2.10.3 and Dart SDK is 2.16.1 and I am using the Getx State Management when I click on the date field I am getting this exception the initial date is not greater than or equal to minimumDate Thank you :)