m3uzz / date_time_picker

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.
https://pub.dartlang.org/packages/date_time_picker
Other
105 stars 162 forks source link

Locale date has not been initialized when use24HourFormat set to false #69

Open AniketDhanak opened 2 years ago

AniketDhanak commented 2 years ago
 [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LocaleDataException: Locale data has not been initialized, call initializeDateFormatting(<locale>).
E/flutter ( 4297): #0      UninitializedLocaleData._throwException (package:intl/src/intl_helpers.dart:80:5)
E/flutter ( 4297): #1      UninitializedLocaleData.containsKey (package:intl/src/intl_helpers.dart:74:7)
E/flutter ( 4297): #2      DateFormat.localeExists (package:intl/src/intl/date_format.dart:834:28)
E/flutter ( 4297): #3      verifiedLocale (package:intl/src/intl_helpers.dart:159:19)
E/flutter ( 4297): #4      new DateFormat (package:intl/src/intl/date_format.dart:266:27)
E/flutter ( 4297): #5      _DateTimePickerState.set12HourTimeValues (package:date_time_picker/date_time_picker.dart:763:20)
E/flutter ( 4297): #6      _DateTimePickerState._showDateTimePickerDialog (package:date_time_picker/date_time_picker.dart:876:11)
E/flutter ( 4297): <asynchronous suspension>
E/flutter ( 4297): 

It is only coming for use24HourFormat: true, If it is set to false it doesn't throw error

Awesomeplayer165 commented 1 year ago

I also have this problem. Is there any update on this?

I tried calling initializeDateFormatting() myself but to no avail

saurabhmore commented 1 year ago

Facing the same issue needed 12hr format with locale support. Is this issue fixed??