MCPcopy
hub / github.com/date-fns/date-fns / formatTimezoneShort

Function formatTimezoneShort

pkgs/core/src/_lib/format/formatters/index.ts:769–778  ·  view source on GitHub ↗
(offset: number, delimiter: string = "")

Source from the content-addressed store, hash-verified

767};
768
769function formatTimezoneShort(offset: number, delimiter: string = ""): string {
770 const sign = offset > 0 ? "-" : "+";
771 const absOffset = Math.abs(offset);
772 const hours = Math.trunc(absOffset / 60);
773 const minutes = absOffset % 60;
774 if (minutes === 0) {
775 return sign + String(hours);
776 }
777 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
778}
779
780function formatTimezoneWithOptionalMinutes(
781 offset: number,

Callers 1

index.tsFile · 0.85

Calls 1

addLeadingZerosFunction · 0.90

Tested by

no test coverage detected