formatDateAsIso8601WithMillisPrecision function
Formats a Date as ISO8601 and UTC with millis precision
Implementation
@internal
String formatDateAsIso8601WithMillisPrecision(DateTime date) {
var iso = date.toIso8601String();
final millisecondSeparatorIndex = iso.lastIndexOf('.');
if (millisecondSeparatorIndex != -1) {
// + 4 for millis precision
iso = iso.substring(0, millisecondSeparatorIndex + 4);
}
// appends Z because the substring removed it
return '${iso}Z';
}