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

Function S

pkgs/core/src/_lib/format/lightFormatters/index.ts:84–91  ·  view source on GitHub ↗
(date: Date, token: string)

Source from the content-addressed store, hash-verified

82
83 // Fraction of second
84 S(date: Date, token: string): string {
85 const numberOfDigits = token.length;
86 const milliseconds = date.getMilliseconds();
87 const fractionalSeconds = Math.trunc(
88 milliseconds * Math.pow(10, numberOfDigits - 3),
89 );
90 return addLeadingZeros(fractionalSeconds, token.length);
91 },
92};

Callers

nothing calls this directly

Calls 1

addLeadingZerosFunction · 0.90

Tested by

no test coverage detected