@@ -5,7 +5,7 @@ import { IntlBase as base, setDateFormat } from './intl-base';
55import { isUndefined , throwError , getValue , isBlazor } from '../util' ;
66import { HijriParser } from '../hijri-parser' ;
77import { isNullOrUndefined , extend } from '../util' ;
8- const abbreviateRegexGlobal : RegExp = / \/ M M M M M | M M M M | M M M | a | L L L L | L L L | E E E E E | E E E E | E | K | c c c c | c c c | W W | W | G + | z + / gi;
8+ const abbreviateRegexGlobal : RegExp = / \/ M M M M M | M M M M | M M M | a | B | L L L L | L L L | E E E E E | E E E E | E | K | c c c c | c c c | W W | W | G + | z + / gi;
99const standalone : string = 'stand-alone' ;
1010const weekdayKey : string [ ] = [ 'sun' , 'mon' , 'tue' , 'wed' , 'thu' , 'fri' , 'sat' ] ;
1111export const basicPatterns : string [ ] = [ 'short' , 'medium' , 'long' , 'full' ] ;
@@ -48,6 +48,7 @@ export const datePartMatcher: { [key: string]: Object } = {
4848 's' : 'second' ,
4949 'L' : 'month' ,
5050 'a' : 'designator' ,
51+ 'B' : 'designator' ,
5152 'z' : 'timeZone' ,
5253 'Z' : 'timeZone' ,
5354 'G' : 'era' ,
@@ -120,6 +121,10 @@ export class DateFormat {
120121 formatOptions . designator = isBlazor ( ) ?
121122 getValue ( 'dayPeriods' , dateObject ) : getValue ( 'dayPeriods.format.wide' , dateObject ) ;
122123 break ;
124+ case 'B' :
125+ formatOptions . designator = isBlazor ( ) ?
126+ getValue ( 'dayPeriods' , dateObject ) : getValue ( 'dayPeriods.format.wide' , dateObject ) ;
127+ break ;
123128 case 'G' : {
124129 const eText : string = ( len <= 3 ) ? 'eraAbbr' : ( len === 4 ) ? 'eraNames' : 'eraNarrow' ;
125130 formatOptions . era = isBlazor ( ) ? getValue ( 'eras' , dateObject ) : getValue ( 'eras.' + eText , dependable . dateObject ) ;
@@ -218,6 +223,11 @@ export class DateFormat {
218223 ret += ( < any > options ) . designator [ `${ desig } ` ] ;
219224 break ;
220225 }
226+ case 'B' : {
227+ const desigs : string = value . getHours ( ) < 12 ? 'am' : 'pm' ;
228+ ret += ( < any > options ) . designator [ `${ desigs } ` ] ;
229+ break ;
230+ }
221231 case 'G' : {
222232 const dec : number = value . getFullYear ( ) < 0 ? 0 : 1 ;
223233 let retu : string = ( < any > options ) . era [ `${ dec } ` ] ;
0 commit comments