Skip to content

Commit

Permalink
feat: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
badosz0 committed Sep 7, 2024
1 parent 10a7541 commit 1ffcc5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 67 deletions.
69 changes: 10 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
![holyTime](https://github.com/tomcru/holy-time/assets/35841182/51051dd9-d0db-4bf7-9cbd-21bcc8c98fd5)

<h1>Holy Time</h1>
<a href="https://www.npmjs.com/package/holy-time"><img src="https://img.shields.io/npm/v/holy-time.svg?style=flat" /></a>
<br>
<br>
[![License: MIT][license-image]][license-url]
[![NPM version][npm-image]][npm-url]
[![JSR version][jsr-image]][jsr-url]

> Yet another (type-safe) date time library
Expand Down Expand Up @@ -51,61 +50,13 @@ HolyTime
.add(30, 'minutes')
.in('seconds')

```
## Instance Methods
```ts
add(amount: number, unit: HumanUnit): this;
subtract(amount: number, unit: HumanUnit): this;

isLeapYear(): boolean;
isWeekend(): boolean;
isAfter(time: TimeResolvable): boolean;
isBefore(time: TimeResolvable): boolean;
isEqual(time: TimeResolvable): boolean;

startOf(unit: IntervalUnit, timeZone?: TimeZone): HolyTime;
endOf(unit: IntervalUnit, timeZone?: TimeZone): HolyTime;
next(unit: IntervalUnit, timeZone?: TimeZone): HolyTime;

getDate(): Date;
getTime(): number;
getISOString(): string;

format(format: string, timeZone?: TimeZone): string;
getRelativeTo(time: TimeResolvable): string;
getRelativeFrom(time: TimeResolvable): string;
```

## Static Methods
```ts
now(): HolyTime;
in(amount: number, unit: HumanUnit): HolyTime

add(time: TimeResolvable, amount: number, unit: HumanUnit): HolyTime;
subtract(time: TimeResolvable, amount: number, unit: HumanUnit): HolyTime;

between(timeA: TimeResolvable, timeB: TimeResolvable): HolyDuration;
since(time: TimeResolvable): number;

isLeapYear(time: TimeResolvable): boolean;
isWeekend(time: TimeResolvable): boolean;
isAfter(timeA: TimeResolvable, timeB: TimeResolvable): boolean;
isBefore(timeA: TimeResolvable, timeB: TimeResolvable): boolean;
isEqual(timeA: TimeResolvable, timeB: TimeResolvable): boolean;

max(...times: TimeResolvable[]): HolyTime;
min(...times: TimeResolvable[]): HolyTime;

startOf(unit: IntervalUnit, time: TimeResolvable, timeZone?: TimeZone): HolyTime;
endOf(unit: IntervalUnit, time: TimeResolvable, timeZone?: TimeZone): HolyTime;
next(unit: IntervalUnit, time: TimeResolvable, timeZone?: TimeZone): HolyTime;

format(time: TimeResolvable, format: string, timeZone?: TimeZone): string;
relativeFromTo(timeA: TimeResolvable, timeB: TimeResolvable): string;

duration(amount: number, unit: HumanUnit): HolyDuration;
```

## License

[MIT](https://tldrlegal.com/license/mit-license)

[license-image]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square
[license-url]: https://opensource.org/licenses/MIT
[npm-image]: https://img.shields.io/npm/v/holy-time.svg?style=flat-square
[npm-url]: https://npmjs.org/package/holy-time
[jsr-image]: https://jsr.io/badges/@badosz/holy-time?style=flat-square
[jsr-url]: https://jsr.io/@badosz/holy-time
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@badosz/holy-time",
"version": "4.1.0",
"version": "5.2.0",
"exports": "./src/index.ts"
}
7 changes: 0 additions & 7 deletions src/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ export class HolyTime {
return HolyTime.isWeekend(this);
}

/**
* Determines if a given year is a leap year.
*
* A leap year is a year that is divisible by 4, except for end-of-century years,
* which must be divisible by 400. This means that the year 2000 was a leap year,
* although 1900 was not.
*/
public static isLeapYear(year: number): boolean {
if (
typeof year !== 'number' ||
Expand Down

0 comments on commit 1ffcc5c

Please sign in to comment.