dateToGitHubIso8601 function Null safety

String? dateToGitHubIso8601(
  1. DateTime? date
)

Converts the date to GitHub's ISO-8601 format:

The format is "YYYY-MM-DDTHH:mm:ssZ"

Implementation

String? dateToGitHubIso8601(DateTime? date) {
  if (date == null) {
    return null;
  }
  // Regex removes the milliseconds.
  return date.toUtc().toIso8601String().replaceAll(githubDateRemoveRegExp, '');
}