# brieftime **Repository Path**: sourcebuild/brieftime ## Basic Information - **Project Name**: brieftime - **Description**: 简明的时间处理 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-11 - **Last Updated**: 2025-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # brieftime > brieftime 时间处理库,常用于时间格式化、比较、判断等。 ## 安装 ```js // npm npm i brieftime // yarn yarn add brieftime // pnpm pnpm i brieftime ``` ## 快速使用 ```js import {brieftime} from "brieftime"; ``` 解析时间 ```js let t1 = brieftime(); // 默认当前时间 let t2 = brieftime("2025-04-11 15:09:00"); // 2025-04-11 15:09:00 let t3 = brieftime(1744355990453); // 2025-04-11 15:19:50 let t4 = brieftime(new Date()); //2025-04-11 15:09:00 // 当前时间 let t5 = brieftime().now() // 传入 Date let t6 = brieftime().createFromStdDate(new Date("2025-04-11 15:00:00")) ``` 时间格式化 > 年:yyyy 月:mm 日:dd 时:HH|hh 分:MM 秒:ss ```js let t = brieftime() t.format("yyyy-mm-dd hh:MM:ss") //2025-04-11 15:09:00 ``` 时间比较 ```js let t1 = brieftime().createFromStdDate(new Date("2025-04-11 15:00:00")) let t2 = brieftime().createFromStdDate(new Date("2025-04-11 15:10:00")) // 是否等于 t1.eq(t2) // false // 是否大于 t1.gt(t2) // false // 是否大于等于 t1.gte(t2) // false // 是否小于 t1.lt(t2) // true // 是否小于等于 t1.lte(t2) // true ```