FhirDate constructor

FhirDate(
  1. dynamic inValue
)

Implementation

factory FhirDate(dynamic inValue) {
  if (inValue is DateTime) {
    return FhirDate.fromDateTime(inValue);
  } else if (inValue is String) {
    try {
      final DateTime dateTimeValue = _parseDate(inValue);
      return FhirDate._(
          inValue, dateTimeValue, true, _getPrecision(inValue), null);
    } on FormatException catch (e) {
      return FhirDate._(inValue, null, false, DatePrecision.INVALID, e);
    }
  } else {
    throw CannotBeConstructed<FhirDate>(
        'Date cannot be constructed from $inValue.');
  }
}