format method

String format([
  1. String pattern = 'YYYY-MM-DDTHH:mm:ssZ'
])

Formats wall-clock time using Hora tokens and target timezone offset.

Implementation

String format([String pattern = 'YYYY-MM-DDTHH:mm:ssZ']) {
  final transformed = _injectOffsetPlaceholders(pattern);
  final rendered = wallClock.format(transformed);
  return rendered
      .replaceAll(_offsetTokenColonMarker, timezone.offsetString)
      .replaceAll(
        _offsetTokenCompactMarker,
        timezone.offsetString.replaceAll(':', ''),
      );
}