@@ -61,7 +61,7 @@ var dateFormat = function () {
6161 } ;
6262
6363 // Regexes and supporting functions are cached through closure
64- return function ( date , mask , utc ) {
64+ return function ( date , mask , utc , gmt ) {
6565 var dF = dateFormat ;
6666
6767 // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
@@ -82,10 +82,14 @@ var dateFormat = function () {
8282
8383 mask = String ( dF . masks [ mask ] || mask || dF . masks [ "default" ] ) ;
8484
85- // Allow setting the utc argument via the mask
86- if ( mask . slice ( 0 , 4 ) == "UTC:" ) {
85+ // Allow setting the utc/gmt argument via the mask
86+ var maskSlice = mask . slice ( 0 , 4 ) ;
87+ if ( maskSlice == "UTC:" || maskSlice == "GMT:" ) {
8788 mask = mask . slice ( 4 ) ;
8889 utc = true ;
90+ if ( maskSlice == "GMT:" ) {
91+ gmt = true ;
92+ }
8993 }
9094
9195 var _ = utc ? "getUTC" : "get" ,
@@ -125,7 +129,7 @@ var dateFormat = function () {
125129 tt : H < 12 ? "am" : "pm" ,
126130 T : H < 12 ? "A" : "P" ,
127131 TT : H < 12 ? "AM" : "PM" ,
128- Z : utc ? "UTC" : ( String ( date ) . match ( timezone ) || [ "" ] ) . pop ( ) . replace ( timezoneClip , "" ) ,
132+ Z : gmt ? "GMT" : utc ? "UTC" : ( String ( date ) . match ( timezone ) || [ "" ] ) . pop ( ) . replace ( timezoneClip , "" ) ,
129133 o : ( o > 0 ? "-" : "+" ) + pad ( Math . floor ( Math . abs ( o ) / 60 ) * 100 + Math . abs ( o ) % 60 , 4 ) ,
130134 S : [ "th" , "st" , "nd" , "rd" ] [ d % 10 > 3 ? 0 : ( d % 100 - d % 10 != 10 ) * d % 10 ] ,
131135 W : W ,
0 commit comments