-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# nepdate | ||
A Java 8 Nepali date converter library | ||
|
||
Available on maven central | ||
|
||
Using gradle | ||
```gradle | ||
implementation 'io.github.aagitoex:nepdate:0.0.1-alpha02' | ||
``` | ||
|
||
OR | ||
|
||
Maven | ||
```xml | ||
<dependency> | ||
<groupId>io.github.aagitoex</groupId> | ||
<artifactId>nepdate</artifactId> | ||
<version>0.0.1-alpha02</version> | ||
</dependency> | ||
``` | ||
|
||
Use cases | ||
### Conversion | ||
```java | ||
//from AD to BS | ||
NepDate nepDate = fromADToBS(LocalDate.now()); | ||
int year = nepDate.getYear(); | ||
int month = nepDate.getMonth(); | ||
int day = nepDate.getDay(); | ||
|
||
//from BS to AD | ||
LocalDate date = fromBSToAD(NepDate.now()); | ||
``` | ||
|
||
### Working with `NepDate` only | ||
```java | ||
//static helpers | ||
NepDate nepDate = NepDate.now(); | ||
NepDate nepDate = NepDate.MAX; | ||
NepDate nepDate = NepDate.MIN; | ||
int daysInMonth = NepDate.getDaysInMonth(year, month); | ||
int daysInYear = NepDate.getDaysInYear(year); | ||
|
||
//addition and subtraction | ||
nepDate.plusDays(10); //addition | ||
nepDate.plusDays(-5); //subtraction | ||
nepDate.plusMonths(34); | ||
nepDate.plusYears(10); | ||
|
||
//count days | ||
nepDate.daysBetween(NepDate.now()); | ||
|
||
//get AD equivalent | ||
LocalDate date = nepDate.getAD(); | ||
|
||
//supports comparision through java's `Comparable<>` interface | ||
Arrays.sort(nepDateArray); | ||
``` | ||
|
||
Documentation work in progress |