[Time] Fix TZDate constructor
authorRicardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
Tue, 17 Sep 2013 14:03:45 +0000 (11:03 -0300)
committerRicardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
Wed, 18 Sep 2013 13:43:41 +0000 (10:43 -0300)
Some of the arguments are optional

time/time_api.js

index 313aea8..2bbfd53 100644 (file)
@@ -96,14 +96,17 @@ tizen.TimeDuration.prototype.toString = function() {
 tizen.TZDate = (function() {
   var TZDate = function(year, month, day, hours, minutes, seconds, milliseconds, timezone) {
     var date_;
+    var hours = hours || 0;
+    var minutes = minutes || 0;
+    var seconds = seconds || 0;
+    var milliseconds = milliseconds || 0;
+    var timezone_ = timezone || tizen.time.getLocalTimezone();
 
     if (!arguments.length)
       date_ = new Date();
     else
       date_ = new Date(year, month, day, hours, minutes, seconds, milliseconds);
 
-    var timezone_ = timezone || tizen.time.getLocalTimezone();
-
     var toTimezone = function(timezone) {
         return new TZDate(date_.getFullYear(), date_.getMonth(),
               date_.getDate(), date_.getHours(), date_.getMinutes(),