fnStrToDate function

dynamic fnStrToDate(
  1. dynamic value
)

Implementation

dynamic fnStrToDate(dynamic value) {
  var s = varToStr(value).replaceAll("/", "-");
  final dt = DateTime.tryParse(s);
  if (dt == null) return null;
  // Takes only the date portion, zeroing the time, so that if the string
  // carries a time component it doesn't get counted into the fractional part.
  return _toDelphiSerial(DateTime(dt.year, dt.month, dt.day));
}