hostDateTime property

DateTime? get hostDateTime

The host writes yyyyMMddHHmmss; anything shorter is left null.

Implementation

DateTime? get hostDateTime {
  final String? value = tag(PrimitiveTags.serverDateTime);
  if (value == null || value.length < 14) return null;
  return DateTime.tryParse(
    "${value.substring(0, 4)}-${value.substring(4, 6)}-${value.substring(6, 8)} "
    "${value.substring(8, 10)}:${value.substring(10, 12)}:${value.substring(12, 14)}",
  );
}