Skip to content

feat(core)!: remove dateDiff from the core public API #498

Description

@marcalexiei

dateDiff is declared in packages/core/src/common/ops.ts

/**
* Get diff in minutes between two dates.
*
* @param d1 First date.
* @param d2 Second date.
* @returns Number of minutes between the two dates.
*/
const dateDiff = (d1: Date, d2: Date): number => {
const date1 = new Date(d1);
const date2 = new Date(d2);
const diff = date1.getTime() - date2.getTime();
return Math.round(diff / (1000 * 60));
};

and re-exported from packages/core/src/index.ts

export { dateDiff, clampValue } from "./common/ops.js";

but nothing inside core calls it.
Its only consumer in the repo is one line in apps/backend/api-renamed/status/pat-info.js:

resetIn: dateDiff(date2, date1) + " minutes",

A five-line date helper should not be part of the published surface of @stats-organization/github-readme-stats-core just to serve one backend call site.
If someone was relying on him, they could inline an equivalent in a minute.


Note

This removes a public export so it should be shipped it as a breaking version bump.
I would consider to ship this alongside a new new major of the action so we can switch to a more standard approach there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions