feat(smarttime.units): Add function to get human-readable time ago string from milliseconds.

This commit is contained in:
Philipp Kunz 2024-12-13 22:04:26 +01:00
parent 71ce4de8ff
commit 55c2d95b7d
3 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,10 @@
# Changelog
## 2024-12-13 - 4.1.0 - feat(smarttime.units)
Add function to get human-readable time ago string from milliseconds.
- Introduced `getMilliSecondsAsHumanReadableAgoTime` to convert a timestamp to a human-readable text indicating time ago.
## 2024-12-13 - 4.0.9 - fix(dependencies)
Updated dependencies in package.json and resolved cron function issues.

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smarttime',
version: '4.0.9',
version: '4.1.0',
description: 'Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.'
}

View File

@ -67,3 +67,7 @@ export let getMilliSecondsFromUnits = (combinationArg: IUnitCombinationArg) => {
export const getMilliSecondsAsHumanReadableString = (milliSecondsArg: number): string => {
return plugins.prettyMs(milliSecondsArg);
};
export const getMilliSecondsAsHumanReadableAgoTime = (timeStampArg: number): string => {
return plugins.dateFns.formatDistanceToNow(timeStampArg);
}