Skip to content

Commit

Permalink
Merge pull request #4 from lapaliv/develop
Browse files Browse the repository at this point in the history
Added new methods:
  • Loading branch information
lapaliv authored May 12, 2020
2 parents 6d4a662 + f81e83a commit ed1fbd5
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 3 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# DateTimeFormatter

![npm licence](https://img.shields.io/npm/l/@lapaliv/datetime-formatter)

## Import
```typescript
// ES6
Expand Down Expand Up @@ -126,6 +130,19 @@ isToday(): boolean;
isTomorrow(): boolean;
isYesterday(): boolean;

isJanuary(): boolean;
isFebruary(): boolean;
isMarch(): boolean;
isApril(): boolean;
isMay(): boolean;
isJune(): boolean;
isJuly(): boolean;
isAugust(): boolean;
isSeptember(): boolean;
isOctober(): boolean;
isNovember(): boolean;
isDecember(): boolean;

isCurrentMicrosecond(): boolean;
isCurrentMillisecond(): boolean;
isCurrentSecond(): boolean;
Expand Down
2 changes: 1 addition & 1 deletion datetime-formatter.js

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,54 @@ declare module '@lapaliv/datetime-formatter' {
* Returns 'true' if the current date is in the current century
*/
isCurrentCentury(): boolean;
/**
* Returns `true` if the current month is January
*/
isJanuary(): boolean;
/**
* Returns `true` if the current month is February
*/
isFebruary(): boolean;
/**
* Returns `true` if the current month is March
*/
isMarch(): boolean;
/**
* Returns `true` if the current month is April
*/
isApril(): boolean;
/**
* Returns `true` if the current month is May
*/
isMay(): boolean;
/**
* Returns `true` if the current month is June
*/
isJune(): boolean;
/**
* Returns `true` if the current month is July
*/
isJuly(): boolean;
/**
* Returns `true` if the current month is August
*/
isAugust(): boolean;
/**
* Returns `true` if the current month is September
*/
isSeptember(): boolean;
/**
* Returns `true` if the current month is October
*/
isOctober(): boolean;
/**
* Returns `true` if the current month is November
*/
isNovember(): boolean;
/**
* Returns `true` if the current month is December
*/
isDecember(): boolean;
/**
* Returns the microseconds
*/
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
"name": "@lapaliv/datetime-formatter",
"description": "The library for work with date and time",
"private": false,
"version": "0.1.10",
"version": "0.1.11",
"keywords": [
"date",
"time",
"datetime",
"formatter",
"datetime-formatter",
"php-datetime",
"php-date"
"php-date",
"carbon"
],
"homepage": "https://github.com/lapaliv/datetime-formatter",
"author": {
Expand Down
84 changes: 84 additions & 0 deletions src/DateTimeFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,90 @@ export class DateTimeFormatter {
&& this.getYear() <= now.endOfCentury().getYear();
}

/**
* Returns `true` if the current month is January
*/
isJanuary(): boolean {
return this.getMonth() === 1;
}

/**
* Returns `true` if the current month is February
*/
isFebruary(): boolean {
return this.getMonth() === 2;
}

/**
* Returns `true` if the current month is March
*/
isMarch(): boolean {
return this.getMonth() === 3;
}

/**
* Returns `true` if the current month is April
*/
isApril(): boolean {
return this.getMonth() === 4;
}

/**
* Returns `true` if the current month is May
*/
isMay(): boolean {
return this.getMonth() === 5;
}

/**
* Returns `true` if the current month is June
*/
isJune(): boolean {
return this.getMonth() === 6;
}

/**
* Returns `true` if the current month is July
*/
isJuly(): boolean {
return this.getMonth() === 7;
}

/**
* Returns `true` if the current month is August
*/
isAugust(): boolean {
return this.getMonth() === 8;
}

/**
* Returns `true` if the current month is September
*/
isSeptember(): boolean {
return this.getMonth() === 9;
}

/**
* Returns `true` if the current month is October
*/
isOctober(): boolean {
return this.getMonth() === 10;
}

/**
* Returns `true` if the current month is November
*/
isNovember(): boolean {
return this.getMonth() === 11;
}

/**
* Returns `true` if the current month is December
*/
isDecember(): boolean {
return this.getMonth() === 12;
}

/**
* Returns the microseconds
*/
Expand Down

0 comments on commit ed1fbd5

Please sign in to comment.