toIso8601String method

String toIso8601String()

Implementation

String toIso8601String() {
  var str = "";
  if (negated) str += "-";
  str += "P";
  bool hasTime = false;
  for (final unit in TimeSpanUnit.values) {
    final section = unit.append(this);
    if (section.isNotEmpty && unit.isTimeField && !hasTime) {
      hasTime = true;
      str += "T";
    }
    str += section;
  }
  return str;
}