increment

import { increment } from "jsr:@ende/chronver";

function

function increment(version: ChronVer, date: Date = [UNSUPPORTED]): ChronVer

Returns the next version on the given date, in local time.

If the version is from the same day, its changeset goes up by one. If it's from an earlier day, the result is that date's version with changeset 0. Either way the result has no feature and isn't breaking, so 2024.04.03.1-break becomes 2024.04.03.2 on the same day.

version: ChronVer

The version to increment

date: Date = [UNSUPPORTED]

The date of the new version

Returns

The next ChronVer

Example: Usage

import { format, increment, parse } from "@ende/chronver";
import { assertEquals } from "@ende/assert";

const version = parse("2024.04.03.1");

assertEquals(format(increment(version, new Date(2024, 3, 3))), "2024.04.03.2");
assertEquals(format(increment(version, new Date(2024, 3, 4))), "2024.04.04");

Source