@@ -279,7 +279,7 @@ class Dayjs {
279279 const zoneStr = Utils . z ( this )
280280 const locale = this . $locale ( )
281281 const {
282- weekdays, months
282+ weekdays, months, meridiem
283283 } = locale
284284 const getShort = ( arr , index , full , length ) => (
285285 ( arr && arr [ index ] ) || full [ index ] . substr ( 0 , length )
@@ -288,6 +288,11 @@ class Dayjs {
288288 Utils . s ( this . $H % 12 || 12 , num , '0' )
289289 )
290290
291+ const meridiemFunc = meridiem || ( ( hour , minute , isLowercase ) => {
292+ const m = ( hour < 12 ? 'AM' : 'PM' )
293+ return isLowercase ? m . toLowerCase ( ) : m
294+ } )
295+
291296 const matches = {
292297 YY : String ( this . $y ) . slice ( - 2 ) ,
293298 YYYY : String ( this . $y ) ,
@@ -305,8 +310,8 @@ class Dayjs {
305310 HH : Utils . s ( this . $H , 2 , '0' ) ,
306311 h : get$H ( 1 ) ,
307312 hh : get$H ( 2 ) ,
308- a : this . $H < 12 ? 'am' : 'pm' ,
309- A : this . $H < 12 ? 'AM' : 'PM' ,
313+ a : meridiemFunc ( this . $H , this . $m , true ) ,
314+ A : meridiemFunc ( this . $H , this . $m , false ) ,
310315 m : String ( this . $m ) ,
311316 mm : Utils . s ( this . $m , 2 , '0' ) ,
312317 s : String ( this . $s ) ,
0 commit comments