dartifyDate function
Implementation
DateTime? dartifyDate(Object jsObject) {
if (util.hasProperty(jsObject, 'toDateString')) {
try {
var date = jsObject as dynamic;
// ignore: avoid_dynamic_calls
return DateTime.fromMillisecondsSinceEpoch(date.getTime());
}
// TODO(rrousselGit): document why try/catch is needed here or find an alternative
// ignore: avoid_catching_errors
on NoSuchMethodError {
// so it's not a JsDate!
return null;
}
}
return null;
}