Skip to content

Commit

Permalink
fix: fix Bengali [bn] locale monthsShort error
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun committed Jan 26, 2021
1 parent 82ef9a3 commit a0e6c0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/locale/bn.js
Expand Up @@ -32,7 +32,7 @@ const locale = {
weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'),
months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
monthsShort: 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'),
monthsShort: 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'),
weekdaysMin: 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.split('_'),
preparse(string) {
return string.replace(/[১২৩৪৫৬৭৮৯০]/g, match => numberMap[match])
Expand Down
10 changes: 10 additions & 0 deletions test/locale/bn.test.js
Expand Up @@ -35,6 +35,16 @@ it('Format Month with locale function', () => {
}
})

it('Month short', () => {
const date = '2021-02-01T05:54:32.005Z'
const dayjsBN = dayjs(date)
.locale('bn')
const momentBN = moment(date)
.locale('bn')
const testFormat1 = 'DD MMMM YYYY MMM'
expect(dayjsBN.format(testFormat1)).toEqual(momentBN.format(testFormat1))
})

it('Preparse with locale function', () => {
for (let i = 0; i <= 7; i += 1) {
dayjs.locale('bn')
Expand Down

0 comments on commit a0e6c0c

Please sign in to comment.