In some locale data in moment.js such as zh, llll date format already
uses MMMM and dddd. The original attempt to expand MMM to MMMM and ddd
to dddd inadvertently expands MMMM to MMMMM and dddd to ddddd, which is
then interpreted as MMMM or dddd followed by an unexpected single M or d.
Change-Id: I2634dfbaaf9615a13dce7b8f4ba3c3bea6863a91
format = llll.replace( lll.replace( ll, '' ), '' );
if ( this.longDisplayFormat ) {
- format = format.replace( 'MMM', 'MMMM' ).replace( 'ddd', 'dddd' );
+ // Replace MMM to MMMM and ddd to dddd but don't change MMMM and dddd
+ format = format.replace( /MMMM?/, 'MMMM' ).replace( /dddd?/, 'dddd' );
}
return format;