@@ -195,12 +195,17 @@ angular.service('$browser', function(){
195
195
function TzDate ( offset , timestamp ) {
196
196
if ( angular . isString ( timestamp ) ) {
197
197
var tsStr = timestamp ;
198
- timestamp = angular . String . toDate ( timestamp ) . getTime ( ) ;
198
+
199
+ this . origDate = angular . String . toDate ( timestamp ) ;
200
+
201
+ timestamp = this . origDate . getTime ( ) ;
199
202
if ( isNaN ( timestamp ) )
200
203
throw {
201
204
name : "Illegal Argument" ,
202
205
message : "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string"
203
206
} ;
207
+ } else {
208
+ this . origDate = new Date ( timestamp ) ;
204
209
}
205
210
206
211
var localOffset = new Date ( timestamp ) . getTimezoneOffset ( ) ;
@@ -243,10 +248,34 @@ function TzDate(offset, timestamp) {
243
248
return offset * 60 ;
244
249
} ;
245
250
251
+ this . getUTCFullYear = function ( ) {
252
+ return this . origDate . getUTCFullYear ( ) ;
253
+ } ;
254
+
255
+ this . getUTCMonth = function ( ) {
256
+ return this . origDate . getUTCMonth ( ) ;
257
+ } ;
258
+
259
+ this . getUTCDate = function ( ) {
260
+ return this . origDate . getUTCDate ( ) ;
261
+ } ;
262
+
263
+ this . getUTCHours = function ( ) {
264
+ return this . origDate . getUTCHours ( ) ;
265
+ } ;
266
+
267
+ this . getUTCMinutes = function ( ) {
268
+ return this . origDate . getUTCMinutes ( ) ;
269
+ } ;
270
+
271
+ this . getUTCSeconds = function ( ) {
272
+ return this . origDate . getUTCSeconds ( ) ;
273
+ } ;
274
+
275
+
246
276
//hide all methods not implemented in this mock that the Date prototype exposes
247
- var unimplementedMethods = [ 'getDay' , 'getMilliseconds' , 'getTime' , 'getUTCDate' , 'getUTCDay' ,
248
- 'getUTCFullYear' , 'getUTCHours' , 'getUTCMilliseconds' , 'getUTCMinutes' , 'getUTCMonth' ,
249
- 'getUTCSeconds' , 'getYear' , 'setDate' , 'setFullYear' , 'setHours' , 'setMilliseconds' ,
277
+ var unimplementedMethods = [ 'getDay' , 'getMilliseconds' , 'getTime' , 'getUTCDay' ,
278
+ 'getUTCMilliseconds' , 'getYear' , 'setDate' , 'setFullYear' , 'setHours' , 'setMilliseconds' ,
250
279
'setMinutes' , 'setMonth' , 'setSeconds' , 'setTime' , 'setUTCDate' , 'setUTCFullYear' ,
251
280
'setUTCHours' , 'setUTCMilliseconds' , 'setUTCMinutes' , 'setUTCMonth' , 'setUTCSeconds' ,
252
281
'setYear' , 'toDateString' , 'toJSON' , 'toGMTString' , 'toLocaleFormat' , 'toLocaleString' ,
0 commit comments