@@ -27,21 +27,25 @@ export class DecimalCode extends NumberCode {
27
27
const value : number = - 0.9 ; // Reference value.
28
28
const localeValue : string = new Intl . NumberFormat ( defaultLocale ) . format ( value ) ;
29
29
30
- // Checks Unicode character 'RIGHT-TO-LEFT MARK' (U+200F).
31
- if ( this . Unicode ( localeValue . charAt ( 0 ) ) == "\\u200F" ) {
30
+ const unicodeChars : string [ ] = [ ] ;
31
+ unicodeChars . push ( this . Unicode ( localeValue . charAt ( 0 ) ) ) ;
32
+ unicodeChars . push ( this . Unicode ( localeValue . charAt ( 1 ) ) ) ;
33
+ unicodeChars . push ( this . Unicode ( localeValue . charAt ( 2 ) ) ) ;
34
+ unicodeChars . push ( this . Unicode ( localeValue . charAt ( 3 ) ) ) ;
35
+
36
+ // Checks Unicode characters 'RIGHT-TO-LEFT MARK' (U+200F) & 'Arabic Letter Mark (U+061C)'.
37
+ if ( unicodeChars [ 0 ] == "\\u200F" || unicodeChars [ 0 ] == "\\u061C" ) {
32
38
// Right to left.
33
- this . minusSignCode = this . Unicode ( localeValue . charAt ( 1 ) ) ;
34
- this . decimalSeparatorCode = this . Unicode ( localeValue . charAt ( 3 ) ) ;
35
- } else if ( this . Unicode ( localeValue . charAt ( 0 ) ) == this . Unicode (
36
- new Intl . NumberFormat ( defaultLocale ) . format ( 0 )
37
- ) ) {
38
- // IE & Edge reverse the order.
39
- this . minusSignCode = this . Unicode ( localeValue . charAt ( 3 ) ) ;
40
- this . decimalSeparatorCode = this . Unicode ( localeValue . charAt ( 1 ) ) ;
39
+ this . minusSignCode = unicodeChars [ 1 ] ;
40
+ this . decimalSeparatorCode = unicodeChars [ 3 ] ;
41
+ } else if ( unicodeChars [ 0 ] == this . Unicode ( new Intl . NumberFormat ( defaultLocale ) . format ( 0 ) ) ) {
42
+ // Some IE & Edge versions reverse the order.
43
+ this . minusSignCode = unicodeChars [ 3 ] ;
44
+ this . decimalSeparatorCode = unicodeChars [ 1 ] ;
41
45
} else {
42
46
// Left to right.
43
- this . minusSignCode = this . Unicode ( localeValue . charAt ( 0 ) ) ;
44
- this . decimalSeparatorCode = this . Unicode ( localeValue . charAt ( 2 ) ) ;
47
+ this . minusSignCode = unicodeChars [ 0 ] ;
48
+ this . decimalSeparatorCode = unicodeChars [ 2 ] ;
45
49
}
46
50
}
47
51
}
0 commit comments