getDate method
TZDateTime?
getDate(
- IFactMetaDate metaDate,
- Location location
override
Implementation
TZDateTime? getDate(IFactMetaDate metaDate, Location location) {
final date = getByPath(metaDate.path!);
if (date == null) return null;
TZDateTime? resolvedDate;
if (date is TZDateTime) {
resolvedDate = date;
} else if (date is DateTime) {
resolvedDate = TZDateTime.from(date, location);
} else if (date is FlexiDate) {
final now = DateTime.now();
var stepDate = cloneDate(now, year: date.year, month: date.month, day: date.day);
while (stepDate.isPast) {
stepDate = cloneDate(stepDate, year: stepDate.year + 1);
}
resolvedDate = TZDateTime.from(stepDate, location);
}
return resolvedDate;
}