# leapSecond

Industry: Core

```ts
const leapSecond: RegExp = /^(?:[^[]*?[Tt ]|[Tt]?)\d{2}:?\d{2}:?60(?:[.,]\d+)?(?:[-+Zz[]|$)/;
```

RegExp fragment matching an ISO 8601 leap second (second `60`) in the time of day of a date-time or time string, in every spelling Temporal's `PlainDateTime.from`/`PlainTime.from` grammar parses.

## Examples

```ts
import { leapSecond } from "@northguild/gmt";
```

```ts
leapSecond.test("2024-12-31T23:59:60Z") // true
leapSecond.test("2024-12-31T23:59:60.123+00:00") // true
leapSecond.test("2024-12-31t23:59:60+00:00[UTC]") // true (lowercase t)
leapSecond.test("20241231 235960Z") // true (space separator, basic format)
leapSecond.test("2024-12-31T23:59:60") // true (no designator: PlainDateTime clamps it)
leapSecond.test("23:59:60") // true (a time: PlainTime clamps it)
leapSecond.test("2024-12-31T23:59:59Z") // false (second = 59)
leapSecond.test("2024-01-01T00:00:00Z[x=T123460Z]") // false (inside an annotation value)
```

## Source

[regex/leap-second.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/regex/leap-second.ts)
