0.1.11 • Published 1 year ago
@davidrebollo92/time v0.1.11
Time
Install
npm i @davidrebollo92/time
Documentation
Extended version of Date with more features
The package adds the following functions:
isValid()
day()
daysInMonth()
month()
year()
startOfDay()
add(amount: number, unit: "days" | "months" | "years")
subtract(amount: number, unit: "days" | "months" | "years")
isBefore(date: Time | string)
isAfter(date: Time | string)
isSameOrBefore(date: Time | string)
isSameOrAfter(date: Time | string)
isBetween(startDate: Time | string, endDate: Time | string, rule: "()" | "(]" | "[)" | "[]")
diff(date: Time | string, unit: "minutes" | "days" | "months" | "years")
clone()
format(rule: "YYYYMMDD" | "DDMMYYYY" | "YYMMDD" | "DDMMYY", separator?: "" | "-" | "/")
Example
import { Time } from "@davidrebollo92/time";
// Create a Time instance
const dateNow = new Time();
const dateInFiveDays = new Time().add(5, "days");
console.log(dateNow.isBefore(dateInFiveDays)); // Result: true
0.1.10
1 year ago
0.1.11
1 year ago
0.1.9
1 year ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago