dateFromIsoIgnoreTime function

DateTime? dateFromIsoIgnoreTime(
  1. String? iso
)

Read from ISO but keep only the calendar parts (avoid TZ shifts)

Implementation

DateTime? dateFromIsoIgnoreTime(String? iso) {
  if (iso == null) {
    return null;
  }
  final dt = DateTime.parse(iso); // may be UTC or local depending on 'Z'
  final utc = dt.toUtc(); // normalize to UTC
  return DateTime(utc.year, utc.month, utc.day); // local date with same Y/M/D
}