/** * 比较当前时间与任意时间戳(return 秒) * @param targetTimestamp 时间戳 */ export function getTimestampDifference(targetTimestamp: number): number { const currentTimestamp: number = Math.floor(Date.now() / 1000); // 当前时间戳(秒) // 差异(秒) return currentTimestamp - targetTimestamp; }
【时间戳比较】TypeScript时间戳比较工具
于 2024-05-17 14:34:05 首次发布