Compare commits

...

4 Commits

Author SHA1 Message Date
51943fad1c 4.2.0 2024-12-14 02:22:43 +01:00
ce3af11ca8 feat(ondemand): Add on-demand timestamp feature 2024-12-14 02:22:43 +01:00
a941f10af3 4.1.1 2024-12-13 22:09:31 +01:00
6e7f8f3dda fix(smarttime.units): Fix issue in getMilliSecondsAsHumanReadableAgoTime 2024-12-13 22:09:30 +01:00
5 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,15 @@
# Changelog # Changelog
## 2024-12-14 - 4.2.0 - feat(ondemand)
Add on-demand timestamp feature
- Added an on-demand script to output human-readable time ago for current timestamp.
## 2024-12-13 - 4.1.1 - fix(smarttime.units)
Fix issue in getMilliSecondsAsHumanReadableAgoTime
- Corrected the parameter type passed to date-fns.formatDistanceToNow within getMilliSecondsAsHumanReadableAgoTime function.
## 2024-12-13 - 4.1.0 - feat(smarttime.units) ## 2024-12-13 - 4.1.0 - feat(smarttime.units)
Add function to get human-readable time ago string from milliseconds. Add function to get human-readable time ago string from milliseconds.

View File

@ -1,7 +1,7 @@
{ {
"name": "@push.rocks/smarttime", "name": "@push.rocks/smarttime",
"private": false, "private": false,
"version": "4.1.0", "version": "4.2.0",
"description": "Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.", "description": "Provides utilities for advanced time handling including cron jobs, timestamps, intervals, and more.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",

3
test/ondemand.ts Normal file
View File

@ -0,0 +1,3 @@
import * as smarttime from '../ts/index.js';
console.log(smarttime.getMilliSecondsAsHumanReadableAgoTime(Date.now()));

View File

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

View File

@ -69,5 +69,5 @@ export const getMilliSecondsAsHumanReadableString = (milliSecondsArg: number): s
}; };
export const getMilliSecondsAsHumanReadableAgoTime = (timeStampArg: number): string => { export const getMilliSecondsAsHumanReadableAgoTime = (timeStampArg: number): string => {
return plugins.dateFns.formatDistanceToNow(timeStampArg); return plugins.dateFns.formatDistanceToNow(new Date(timeStampArg));
} }