timeOffset2String static method

String timeOffset2String(
  1. int? offset
)

Implementation

static String timeOffset2String(int? offset) {
  if (offset == null) return "";
  String offsetStr = "";

  int offsetInHours = offset ~/ 1000 ~/ 3600;
  if (offsetInHours >= 10) {
    offsetStr += "+$offsetInHours";
  } else if (offsetInHours >= 0) {
    offsetStr = "+0$offsetInHours";
  } else if (offsetInHours > -10) {
    offsetStr = "-0${-offsetInHours}";
  } else {
    offsetStr = "$offsetInHours";
  }

  offsetStr += ":00";

  return offsetStr;
}