alanchan-dev/OmniDateTimePicker

OmniDateTimePicker doesn't respect the Time information in the passted intial Date

KhatibFX opened this issue · 2 comments

Hi, thanks a lot for your package, and happy holidays!

I find that the OmniDateTimePicker won't consider the Time information in my initial DateTime object. Here's an example:

DateTime date = DateTime.now().toUtc().add(const Duration(hours: -11))

final DateTime? dateTime = await showOmniDateTimePicker(
  context: context,
  is24HourMode: false,
  isShowSeconds: false,
  startInitialDate: date,
  startFirstDate: DateTime.now().toUtc().subtract(const Duration(days: 365)),
  startLastDate: DateTime.now().toUtc(),
  borderRadius: const Radius.circular(16),
);

This resulting picker will show the time as the current device time, instead of the date object's time which is 11 hours behind now.

Also, the FirstDate and LastDate time is not respected as a cutoff time for the time spinners.
Also, opening the dialog and then tapping OK without changing anything will cause the resulting DateTime to be equal to the current day and time, regardless of the initial date passed.
I can produce this on Android.

The bug with startInitialDate not being reflected correctly are fixed in v0.0.3

This part I don't quite get it yet, can you provide an example codes for this and include your expected behavior vs current behavior?
"Also, the FirstDate and LastDate time is not respected as a cutoff time for the time spinners."

Do open a new issue for that part. I'll close this issue for now as the initialDate should be fixed. Thank you!

Thanks a lot, I will open a new issue about it in a few hours, including screenshots to explain the expected behavior vs current behavior