compose static method
DateTime?
compose(
{ - required dynamic date,
- required dynamic time,
- String? offset,
})
Implementation
static DateTime? compose({required dynamic date, required dynamic time, String? offset}) {
DateTime? dateAt = toDate(date);
DateTime? timeAt = toDate(time);
DateTime? dateTime;
if (dateAt != null && timeAt != null && !timeAt.isMidnight) {
dateTime = DateTime(dateAt.year, dateAt.month, dateAt.day, timeAt.hour, timeAt.minute);
} else if (dateAt == null && timeAt != null) {
dateTime = timeAt;
} else {
dateTime = dateAt;
}
return offset == null ? dateTime : dateTime?.add(Duration(minutes: int.parse(offset)));
}