Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for node 22 and remove 16 #101

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Please provide a clear and concise description of your expected outcome.

**Environment**

- npm/node version:
- Package version:
- Operating system:
- Any other relevant information about your environment.
- npm/node version:
- Package version:
- Operating system:
- Any other relevant information about your environment.

**Additional context**
Please provide any additional context or information that may be helpful in understanding and resolving the issue. This can include:

- Error stack trace
- Error messages
- Log files
- Screenshots
- Any other relevant details related to the issue.
- Error stack trace
- Error messages
- Log files
- Screenshots
- Any other relevant details related to the issue.
18 changes: 9 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

Please mark the appropriate option below to describe the type of change your pull request introduces:

- [ ] Bug fix
- [ ] New feature
- [ ] Enhancement
- [ ] Documentation update
- [ ] Refactor
- [ ] Other (please specify)
- [ ] Bug fix
- [ ] New feature
- [ ] Enhancement
- [ ] Documentation update
- [ ] Refactor
- [ ] Other (please specify)

## Checklist

- [ ] I have added/updated the necessary documentation on `README.md`.
- [ ] I have added appropriate test cases (if applicable) to ensure the changes are functioning correctly.
- [ ] My pull request has a clear title and description.
- [ ] I have added/updated the necessary documentation on `README.md`.
- [ ] I have added appropriate test cases (if applicable) to ensure the changes are functioning correctly.
- [ ] My pull request has a clear title and description.

## Additional Notes

Expand Down
6 changes: 3 additions & 3 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ If you discover a security vulnerability within the project, we encourage you to

Upon receiving a security vulnerability report, our team will evaluate the issue and take appropriate actions to address it. This may include:

- Developing and testing a patch or fix for the vulnerability
- Coordinating with the reporter or other relevant parties to verify the vulnerability and its impact
- Releasing a new version that includes the necessary security fixes
- Developing and testing a patch or fix for the vulnerability
- Coordinating with the reporter or other relevant parties to verify the vulnerability and its impact
- Releasing a new version that includes the necessary security fixes

We strive to provide security updates in a timely manner and communicate any necessary steps for users to upgrade to the latest secure version.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18, 20, 22]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}

Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
npm run test
68 changes: 34 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,41 +60,41 @@ The `NepaliDate` class represents a Nepali calendar date. It provides various me

You can create a `NepaliDate` object in several ways:

- Without any parameters: Creates a `NepaliDate` object for the current date and time.
- Without any parameters: Creates a `NepaliDate` object for the current date and time.

```javascript
import NepaliDate from 'nepali-datetime'

const now = new NepaliDate()
```

- Using a Nepali date string: Parses the string as a Nepali calendar date.
- Using a Nepali date string: Parses the string as a Nepali calendar date.

```javascript
const date1 = new NepaliDate('2079-02-15')
const date2 = new NepaliDate('2079-02-15 14:00')
```

- Using a Unix timestamp (in milliseconds):
- Using a Unix timestamp (in milliseconds):

```javascript
const date2 = new NepaliDate(1654210800000)
```

- Using a JavaScript `Date` object: Converts the JavaScript `Date` object to a `NepaliDate` object.
- Using a JavaScript `Date` object: Converts the JavaScript `Date` object to a `NepaliDate` object.

```javascript
const jsDate = new Date()
const date3 = new NepaliDate(jsDate)
```

- Using an existing `NepaliDate` object: Creates a new `NepaliDate` object with the same values.
- Using an existing `NepaliDate` object: Creates a new `NepaliDate` object with the same values.

```javascript
const date4 = new NepaliDate(date3)
```

- Using Nepali calendar date and time parameters: Specifies the components of a Nepali calendar date.
- Using Nepali calendar date and time parameters: Specifies the components of a Nepali calendar date.

```javascript
const date5 = new NepaliDate(year, month, date, hour, minute, second, ms)
Expand All @@ -105,42 +105,42 @@ You can create a `NepaliDate` object in several ways:

You can retrieve various components of a `NepaliDate` object using the following methods:

- `getDateObject()`: Retrieves the Javascript Date object equivalent to the NepaliDate.
- `getTime()`: Retrieves the Unix timestamp (in milliseconds) of the Nepali date.
- `getYear()`: Retrieves the year of the Nepali date in the Nepali calendar.
- `getEnglishYear()`: Retrieves the year of the Nepali date in the English calendar.
- `getMonth()`: Retrieves the month of the Nepali date in the Nepali calendar.
- `getEnglishMonth()`: Retrieves the month of the Nepali date in the English calendar.
- `getDate()`: Retrieves the day of the month of the Nepali date in the Nepali calendar.
- `getEnglishDate()`: Retrieves the day of the month of the Nepali date in the English calendar.
- `getDay()`: Retrieves the day of the week represented by a numeric value.
- `getHours()`: Retrieves the hour value of the Nepali date.
- `getMinutes()`: Retrieves the minute value of the Nepali date.
- `getSeconds()`: Retrieves the second value of the Nepali date.
- `getMilliseconds()`: Retrieves the millisecond value of the Nepali date.
- `getDateObject()`: Retrieves the Javascript Date object equivalent to the NepaliDate.
- `getTime()`: Retrieves the Unix timestamp (in milliseconds) of the Nepali date.
- `getYear()`: Retrieves the year of the Nepali date in the Nepali calendar.
- `getEnglishYear()`: Retrieves the year of the Nepali date in the English calendar.
- `getMonth()`: Retrieves the month of the Nepali date in the Nepali calendar.
- `getEnglishMonth()`: Retrieves the month of the Nepali date in the English calendar.
- `getDate()`: Retrieves the day of the month of the Nepali date in the Nepali calendar.
- `getEnglishDate()`: Retrieves the day of the month of the Nepali date in the English calendar.
- `getDay()`: Retrieves the day of the week represented by a numeric value.
- `getHours()`: Retrieves the hour value of the Nepali date.
- `getMinutes()`: Retrieves the minute value of the Nepali date.
- `getSeconds()`: Retrieves the second value of the Nepali date.
- `getMilliseconds()`: Retrieves the millisecond value of the Nepali date.

#### Setting the Nepali date components

You can set individual components of a `NepaliDate` object using the following methods:

- `setYear(year)`: Sets the year of the Nepali date.
- `setMonth(month)`: Sets the month of the Nepali date.
- `setDate(day)`: Sets the day of the month of the Nepali date.
- `setHours(hour)`: Sets the hour of the Nepali date.
- `setMinutes(minute)`: Sets the minute of the Nepali date.
- `setSeconds(second)`: Sets the second of the Nepali date.
- `setMilliseconds(ms)`: Sets the millisecond of the Nepali date.
- `setTime(time)`: Sets the Nepali date and time values using a Unix timestamp.
- `setYear(year)`: Sets the year of the Nepali date.
- `setMonth(month)`: Sets the month of the Nepali date.
- `setDate(day)`: Sets the day of the month of the Nepali date.
- `setHours(hour)`: Sets the hour of the Nepali date.
- `setMinutes(minute)`: Sets the minute of the Nepali date.
- `setSeconds(second)`: Sets the second of the Nepali date.
- `setMilliseconds(ms)`: Sets the millisecond of the Nepali date.
- `setTime(time)`: Sets the Nepali date and time values using a Unix timestamp.

#### Formatting the Nepali date

You can format a `NepaliDate` object as a string using the `format()` and `formatNepali()` methods.
Additionally, you can convert the corresponding English date to a string using the `formatEnglishDate()` and `formatEnglishDateInNepali()` methods.

- `format(formatStr)`: Returns a string representation (in English) of the `NepaliDate` object in the specified format.
- `formatNepali(formatStr)`: Returns a string representation in the Nepali (Devanagari script) of the `NepaliDate` object in the specified format.
- `formatEnglishDate(formatStr)`: Returns a string representation (in English) of the English Date in the specified format.
- `formatEnglishDateInNepali(formatStr)`: Returns a string representation in the Nepali (Devanagari script) of the English Date in the specified format.
- `format(formatStr)`: Returns a string representation (in English) of the `NepaliDate` object in the specified format.
- `formatNepali(formatStr)`: Returns a string representation in the Nepali (Devanagari script) of the `NepaliDate` object in the specified format.
- `formatEnglishDate(formatStr)`: Returns a string representation (in English) of the English Date in the specified format.
- `formatEnglishDateInNepali(formatStr)`: Returns a string representation in the Nepali (Devanagari script) of the English Date in the specified format.

```javascript
const date = new NepaliDate(2079, 5, 3, 16, 14)
Expand Down Expand Up @@ -217,14 +217,14 @@ console.log(date2.toString()) // 2080-03-23 10:15:00

#### Others

- `NepaliDate.getDaysOfMonth(year, month)`: Returns the number of days in a specific month of a given year.
- `NepaliDate.getDaysOfMonth(year, month)`: Returns the number of days in a specific month of a given year.

### dateConverter

The `dateConverter` module provides core functions for converting dates between the Nepali and English calendars.

- `englishToNepali(year, month, day)`: Converts an English calendar date to a Nepali calendar date. Returns an array `[npYear, npMonth, npDay]` representing the Nepali date.
- `nepaliToEnglish(year, month, day)`: Converts a Nepali calendar date to an English calendar date. Returns an array `[enYear, enYear, enDay]` representing the English date.
- `englishToNepali(year, month, day)`: Converts an English calendar date to a Nepali calendar date. Returns an array `[npYear, npMonth, npDay]` representing the Nepali date.
- `nepaliToEnglish(year, month, day)`: Converts a Nepali calendar date to an English calendar date. Returns an array `[enYear, enYear, enDay]` representing the English date.

> Note: Use 0 as the value for the months Baisakh and January (Javascript Logic 🤷).

Expand Down
Loading
Loading