A small library to convert any valid javascript date to Bangla date.
npm install bangla-calendarA small JavaScript library to convert any valid JavaScript date to Bangla date.
``bash`
$ npm i bangla-calendar
`javascript`
const {
getDate,
getDay,
getWeekDay,
getMonth,
getYear,
} = require('bangla-calendar');
or
`javascript`
import {
getDate,
getDay,
getMonth,
getWeekDay,
getYear,
} from 'bangla-calendar';
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getDate(date1); //output: āĻļā§āĻā§āϰāĻŦāĻžāϰ, ā§§ āĻāĻžāĻĻā§āϰ, ā§§ā§Ē⧍ā§Ŧ
getDate(date1, { format: 'DD/MM/YYYY' }); //output: ā§Ļā§§/ā§Ļā§Ģ/ā§§ā§Ē⧍ā§Ŧ
`
This method returns full Bangla date for a given date.
#### Examples
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getDate(date1); //output: āĻļā§āĻā§āϰāĻŦāĻžāϰ, ā§§ āĻāĻžāĻĻā§āϰ, ā§§ā§Ē⧍ā§Ŧ
getDate(date1, { format: 'DD/MM/YY', calculationMethod: 'BD' }); //output: ā§Ļā§§/ā§Ļā§Ģ/⧍ā§Ŧ
getDate(date1, { format: 'DD/MM/YYYY', calculationMethod: 'BD' }); //output: ā§Ļā§§/ā§Ļā§Ģ/ā§§ā§Ē⧍ā§Ŧ
getDate(date1, { format: 'DD/MM/YYYYb', calculationMethod: 'BD' }); //output: ā§Ļā§§/ā§Ļā§Ģ/ā§§ā§Ē⧍ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ)
getDate(date1, { format: 'D MMMM, YYYY', calculationMethod: 'BD' }); //output: ā§§ āĻāĻžāĻĻā§āϰ, ā§§ā§Ē⧍ā§Ŧ
getDate(date1, { format: 'D MMMM, YYYYb', calculationMethod: 'BD' }); //output: ā§§ āĻāĻžāĻĻā§āϰ, ā§§ā§Ē⧍ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ)
`
#### Parameters
| Parameter | Type | Example |
| --------- | --------------- | ----------------------------------------------------- |
| date | JavaScript date | new Date('August 16 2019 06:22:03') |{ format: 'D MMMM, YYYY', calculationMethod: 'BD' }
| options | object | |
This method returns the day of the Bangla month of the given date.
#### Examples
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getDay(date1); //output: ā§§
getDay(date1, { format: 'DD', calculationMethod: 'BD' }); //output: ā§Ļā§§
getDay(date1, { format: 'D', calculationMethod: 'BD' }); //output: ā§§
`
#### Parameters
| Parameter | Type | Example |
| --------- | --------------- | ------------------------------------------ |
| date | JavaScript date | new Date('August 16 2019 06:22:03') |{ format: 'D', calculationMethod: 'BD' }
| options | object | |
This method returns the day of the Bangla week of the given date.
#### Examples
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getWeekDay(date1); //output: āĻļā§āĻā§āϰāĻŦāĻžāϰ
getWeekDay(date1, { format: 'eeee', calculationMethod: 'BD' }); //output: āĻļā§āĻā§āϰāĻŦāĻžāϰ
getWeekDay(date1, { format: 'eee', calculationMethod: 'BD' }); //output: āĻļā§āĻā§āϰ
`
#### Parameters
| Parameter | Type | Example |
| --------- | --------------- | --------------------------------------------- |
| date | JavaScript date | new Date('August 16 2019 06:22:03') |{ format: 'eeee', calculationMethod: 'BD' }
| options | object | |
This method returns the Bangla month of a given date.
#### Examples
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getMonth(date1); //output: āĻāĻžāĻĻā§āϰ
getMonth(date1, { format: 'M', calculationMethod: 'BD' }); //output: ā§§
getMonth(date1, { format: 'MM', calculationMethod: 'BD' }); //output: ā§Ļā§§
getMonth(date1, { format: 'MMMM', calculationMethod: 'BD' }); //output: āĻāĻžāĻĻā§āϰ
`
#### Parameters
| Parameter | Type | Example |
| --------- | --------------- | --------------------------------------------- |
| date | JavaScript date | new Date('August 16 2019 06:22:03') |{ format: 'MMMM', calculationMethod: 'BD' }
| options | object | |
This method returns the Bangla year of a given date.
#### Examples
`javascript
const date1 = new Date('August 16 2019 06:22:03');
getYear(date1); //output: ā§§ā§Ē⧍ā§Ŧ
getYear(date1, { format: 'YY', calculationMethod: 'BD' }); //output: ⧍ā§Ŧ
getYear(date1, { format: 'YYYY', calculationMethod: 'BD' }); //output: ā§§ā§Ē⧍ā§Ŧ
getYear(date1, { format: 'YYYYb', calculationMethod: 'BD' }); //output: ā§§ā§Ē⧍ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ)
`
#### Parameters
| Parameter | Type | Example |
| --------- | --------------- | --------------------------------------------- |
| date | JavaScript date | new Date('August 16 2019 06:22:03') |{ format: 'YYYY', calculationMethod: 'BD' }` |
| options | object |
#### calculationMethod (string)
| Country | Token |
| ---------- | ----- |
| Bangladesh | BD |
| India | IN |
#### format (string)
| Unit | Token | Result examples |
| ------- | ----- | -------------------------------------------------- |
| Day | D | ā§§, ⧍, ā§Š, ā§Ē, ..., ā§Šā§Ļ, ā§Šā§§ |
| | DD | ā§Ļā§§, ā§Ļ⧍, ā§Ļā§Š, ā§Ļā§Ē, ..., ā§Šā§Ļ, |
| Weekday | eee | āĻļā§āĻā§āϰ, āĻļāύāĻŋ, āϰāĻŦāĻŋ, ..., āĻŦā§āĻšāϏā§āĻĒāϤāĻŋ |
| | eeee | āĻļā§āĻā§āϰāĻŦāĻžāϰ, āĻļāύāĻŋāĻŦāĻžāϰ, āϰāĻŦāĻŋāĻŦāĻžāϰ, ..., āĻŦā§āĻšāϏā§āĻĒāϤāĻŋāĻŦāĻžāϰ |
| Month | M | ā§§, ⧍, ā§Š, ā§Ē, ..., ā§§ā§§, ⧧⧍ |
| | MM | ā§Ļā§§, ā§Ļ⧍, ā§Ļā§Š, ā§Ļā§Ē, ..., ā§§ā§§, ⧧⧍ |
| | MMMM | āĻŦā§āĻļāĻžāĻ, āĻā§āϝā§āώā§āĻ , āĻāώāĻžāĻĸāĻŧ, āĻļā§āϰāĻžāĻŦāĻŖ, ..., āĻĢāĻžāϞā§āĻā§āύ, āĻā§āϤā§āϰ |
| Year | YY | ⧍ā§Ļ, ⧍⧧, ⧍⧍, ..., ⧍ā§Ģ, ⧍ā§Ŧ |
| | YYYY | ā§§ā§Ē⧍ā§Ļ, ā§§ā§Ē⧍⧧, ā§§ā§Ē⧍⧍, ..., ā§§ā§Ē⧍ā§Ģ, ā§§ā§Ē⧍ā§Ŧ |
| | YYYYb | ā§§ā§Ē⧍ā§Ļ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ), ..., ā§§ā§Ē⧍ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ) |