timely-core
v0.1.0
Published
Tiny, TypeScript-first date & time utilities for real-world apps (0 deps).
Maintainers
Readme
timely-core
Tiny, TypeScript-first date & time utilities for real-world apps. 0 dependencies, tree-shakable, small bundle.
Install
npm i timely-coreUsage
import {
timeAgo,
formatDuration,
isBusinessDay,
addBusinessDays,
getDateRange,
syncWithServer,
getAccurateNow,
} from 'timely-core';
timeAgo(Date.now() - 90_000); // "1 minute ago"
formatDuration(7265000); // "2h 1m 5s"
isBusinessDay(new Date());
addBusinessDays(new Date(), 5);
getDateRange('last7days');
syncWithServer(Date.now() + 2500);
getAccurateNow();✅ 2️⃣ Example consumer app (recommended)
Create a demo file outside the library code.
📁 example/index.ts
import {
timeAgo,
formatDuration,
isBusinessDay,
addBusinessDays,
getDateRange,
syncWithServer,
getAccurateNow,
} from 'timely-core';
console.log(timeAgo(Date.now() - 90_000));
console.log(formatDuration(7265000));
console.log(isBusinessDay(new Date()));
console.log(addBusinessDays(new Date(), 5));
console.log(getDateRange('last7days'));
syncWithServer(Date.now() + 2500);
console.log(getAccurateNow());