@@ -279,7 +279,7 @@ class Dayjs {
279
279
const zoneStr = Utils . z ( this )
280
280
const locale = this . $locale ( )
281
281
const {
282
- weekdays, months
282
+ weekdays, months, meridiem
283
283
} = locale
284
284
const getShort = ( arr , index , full , length ) => (
285
285
( arr && arr [ index ] ) || full [ index ] . substr ( 0 , length )
@@ -288,6 +288,11 @@ class Dayjs {
288
288
Utils . s ( this . $H % 12 || 12 , num , '0' )
289
289
)
290
290
291
+ const meridiemFunc = meridiem || ( ( hour , minute , isLowercase ) => {
292
+ const m = ( hour < 12 ? 'AM' : 'PM' )
293
+ return isLowercase ? m . toLowerCase ( ) : m
294
+ } )
295
+
291
296
const matches = {
292
297
YY : String ( this . $y ) . slice ( - 2 ) ,
293
298
YYYY : String ( this . $y ) ,
@@ -305,8 +310,8 @@ class Dayjs {
305
310
HH : Utils . s ( this . $H , 2 , '0' ) ,
306
311
h : get$H ( 1 ) ,
307
312
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 ) ,
310
315
m : String ( this . $m ) ,
311
316
mm : Utils . s ( this . $m , 2 , '0' ) ,
312
317
s : String ( this . $s ) ,
0 commit comments