export const sameDay = ( d1 , d2 ) : boolean => { const parsed_d1 = new Date ( 1000 * d1 ) ; if ( typeof d2 === "number" ) { d2 = new Date ( d2 ) ; } return ( parsed_d1 . getFullYear ( ) === d2 . getFullYear ( ) && parsed_d1 . getMonth ( ) === d2 . getMonth ( ) && parsed_d1 . getDate ( ) === d2 . getDate ( ) ) ; } ; export const sameMonth = ( d1 , d2 ) : boolean => { const parsed_d1 = new Date ( 1000 * d1 ) ; if ( typeof d2 === "number" ) { d2 = new Date ( d2 ) ; } return ( parsed_d1 . getFullYear ( ) === d2 . getFullYear ( ) && parsed_d1 . getMonth ( ) === d2 . getMonth ( ) ) ; } ; param { number } timeStamp return { Date } export const parseDate = ( timeStamp ) : Date => { if ( ! Number . isInteger ( timeStamp ) ) { throw new Error ( "Invalid input!" ) ; } return new Date ( timeStamp * 1000 ) ; } ; export const unixTime = ( ) : number => Math . floor ( Date . now ( ) / 1000 ) ;