File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @tensor-hq/ts-utils" ,
3
- "version" : " 0.2.1 " ,
3
+ "version" : " 0.3.0 " ,
4
4
"description" : " Minimal utilities in TypeScript." ,
5
5
"sideEffects" : false ,
6
6
"module" : " ./dist/esm/index.js" ,
Original file line number Diff line number Diff line change @@ -30,8 +30,9 @@ export const sleep = (time: Timespan): Promise<void> => {
30
30
export const waitMS = async ( ms : number ) : Promise < void > =>
31
31
sleep ( { Millis : ms } ) ;
32
32
33
- export const truncateTime = ( date : Date ) : Date => {
34
- const timePortion = date . getTime ( ) % DAYS ;
33
+ /** Truncates (floors) the time portion of a date to the nearest interval */
34
+ export const truncateTime = ( date : Date , intervalMs : number ) : Date => {
35
+ const timePortion = date . getTime ( ) % intervalMs ;
35
36
return new Date ( date . getTime ( ) - timePortion ) ;
36
37
} ;
37
38
You can’t perform that action at this time.
0 commit comments