Skip to content

Commit

Permalink
fix(datepicker): display correct Hebrew numerals for numbers 11-19
Browse files Browse the repository at this point in the history
  • Loading branch information
maxokorokov authored and pkozlowski-opensource committed Oct 19, 2018
1 parent 36a91e2 commit 5a5c6da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/datepicker/hebrew/hebrew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ describe('hebrew', () => {
describe('hebrewNumerals', () => {
it('should return Hebrew numerals', () => {
expect(hebrewNumerals(3)).toEqual('ג׳');
expect(hebrewNumerals(11)).toEqual('י״א');
expect(hebrewNumerals(15)).toEqual('ט״ו');
expect(hebrewNumerals(19)).toEqual('י״ט');
expect(hebrewNumerals(5777)).toEqual('תשע״ז');
});
});
Expand Down
22 changes: 15 additions & 7 deletions src/datepicker/hebrew/hebrew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,21 @@ export function hebrewNumerals(numerals: number): string {
if (!numerals) {
return '';
}
const hArray0_9 = ['', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט'];
const hArray10_19 =
['י', 'יא‬', 'יב‬', 'יג‬', 'יד‬', 'טו', 'טז‬', 'יז‬', 'יח‬', 'יט‬'];
const hArray20_90 = ['', '', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ'];
const hArray100_900 = ['', 'ק', 'ר', 'ש', 'ת', 'תק', 'תר', 'תש', 'תת', 'תתק'];
const hArray1000_9000 = ['', 'א', 'ב', 'אב', 'בב', 'ה', 'אה', 'בה', 'אבה', 'בבה'];
const geresh = '׳', gershaim = '״';
const hArray0_9 = ['', '\u05d0', '\u05d1', '\u05d2', '\u05d3', '\u05d4', '\u05d5', '\u05d6', '\u05d7', '\u05d8'];
const hArray10_19 = [
'\u05d9', '\u05d9\u05d0', '\u05d9\u05d1', '\u05d9\u05d2', '\u05d9\u05d3', '\u05d8\u05d5', '\u05d8\u05d6',
'\u05d9\u05d6', '\u05d9\u05d7', '\u05d9\u05d8'
];
const hArray20_90 = ['', '', '\u05db', '\u05dc', '\u05de', '\u05e0', '\u05e1', '\u05e2', '\u05e4', '\u05e6'];
const hArray100_900 = [
'', '\u05e7', '\u05e8', '\u05e9', '\u05ea', '\u05ea\u05e7', '\u05ea\u05e8', '\u05ea\u05e9', '\u05ea\u05ea',
'\u05ea\u05ea\u05e7'
];
const hArray1000_9000 = [
'', '\u05d0', '\u05d1', '\u05d1\u05d0', '\u05d1\u05d1', '\u05d4', '\u05d4\u05d0', '\u05d4\u05d1',
'\u05d4\u05d1\u05d0', '\u05d4\u05d1\u05d1'
];
const geresh = '\u05f3', gershaim = '\u05f4';
let mem = 0;
let result = [];
let step = 0;
Expand Down

0 comments on commit 5a5c6da

Please sign in to comment.