A small JavaScript library to convert any valid JavaScript date to Bangla date.
$ npm i bangla-calendar
const {
getDate,
getDay,
getWeekDay,
getMonth,
getYear,
} = require('bangla-calendar');
or
import {
getDate,
getDay,
getMonth,
getWeekDay,
getYear,
} from 'bangla-calendar';
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.
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: ā§§ āĻāĻžāĻĻā§āĻ°, ā§§ā§Ēā§¨ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ)
Parameter | Type | Example |
---|---|---|
date | JavaScript date | new Date('August 16 2019 06:22:03') |
options | object | { format: 'D MMMM, YYYY', calculationMethod: 'BD' } |
This method returns the day of the Bangla month of the given date.
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: ā§§
Parameter | Type | Example |
---|---|---|
date | JavaScript date | new Date('August 16 2019 06:22:03') |
options | object | { format: 'D', calculationMethod: 'BD' } |
This method returns the day of the Bangla week of the given date.
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: āĻļā§āĻā§āĻ°
Parameter | Type | Example |
---|---|---|
date | JavaScript date | new Date('August 16 2019 06:22:03') |
options | object | { format: 'eeee', calculationMethod: 'BD' } |
This method returns the Bangla month of a given date.
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: āĻāĻžāĻĻā§āĻ°
Parameter | Type | Example |
---|---|---|
date | JavaScript date | new Date('August 16 2019 06:22:03') |
options | object | { format: 'MMMM', calculationMethod: 'BD' } |
This method returns the Bangla year of a given date.
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: ā§§ā§Ēā§¨ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ)
Parameter | Type | Example |
---|---|---|
date | JavaScript date | new Date('August 16 2019 06:22:03') |
options | object | { format: 'YYYY', calculationMethod: 'BD' } |
Country | Token |
---|---|
Bangladesh | BD |
India | IN |
Unit | Token | Result examples |
---|---|---|
Day | D | ā§§, ā§¨, ā§Š, ā§Ē, ..., ā§Šā§Ļ, ā§Šā§§ |
DD | ā§Ļā§§, ā§Ļā§¨, ā§Ļā§Š, ā§Ļā§Ē, ..., ā§Šā§Ļ, | |
Weekday | eee | āĻļā§āĻā§āĻ°, āĻļāĻ¨āĻŋ, āĻ°āĻŦāĻŋ, ..., āĻŦā§āĻšāĻ¸ā§āĻĒāĻ¤āĻŋ |
eeee | āĻļā§āĻā§āĻ°āĻŦāĻžāĻ°, āĻļāĻ¨āĻŋāĻŦāĻžāĻ°, āĻ°āĻŦāĻŋāĻŦāĻžāĻ°, ..., āĻŦā§āĻšāĻ¸ā§āĻĒāĻ¤āĻŋāĻŦāĻžāĻ° | |
Month | M | ā§§, ā§¨, ā§Š, ā§Ē, ..., ā§§ā§§, ā§§ā§¨ |
MM | ā§Ļā§§, ā§Ļā§¨, ā§Ļā§Š, ā§Ļā§Ē, ..., ā§§ā§§, ā§§ā§¨ | |
MMMM | āĻŦā§āĻļāĻžāĻ, āĻā§āĻ¯ā§āĻˇā§āĻ , āĻāĻˇāĻžāĻĸāĻŧ, āĻļā§āĻ°āĻžāĻŦāĻŖ, ..., āĻĢāĻžāĻ˛ā§āĻā§āĻ¨, āĻā§āĻ¤ā§āĻ° | |
Year | YY | ā§¨ā§Ļ, ā§¨ā§§, ā§¨ā§¨, ..., ā§¨ā§Ģ, ā§¨ā§Ŧ |
YYYY | ā§§ā§Ēā§¨ā§Ļ, ā§§ā§Ēā§¨ā§§, ā§§ā§Ēā§¨ā§¨, ..., ā§§ā§Ēā§¨ā§Ģ, ā§§ā§Ēā§¨ā§Ŧ | |
YYYYb | ā§§ā§Ēā§¨ā§Ļ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ), ..., ā§§ā§Ēā§¨ā§Ŧ (āĻŦāĻā§āĻāĻžāĻŦā§āĻĻ) |