Skip to content

Commit

Permalink
fix: fix Bengali [bn] locale monthsShort error
Browse files Browse the repository at this point in the history
iamkun committed Jan 26, 2021

Verified

This commit was signed with the committer’s verified signature.
satya164 Satyajit Sahoo
1 parent 82ef9a3 commit a0e6c0c
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/locale/bn.js
Original file line number Diff line number Diff line change
@@ -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])
10 changes: 10 additions & 0 deletions test/locale/bn.test.js
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit a0e6c0c

Please sign in to comment.