← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15160: minor simplification in period js generator

 

------------------------------------------------------------
revno: 15160
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-05-06 11:09:19 +0700
message:
  minor simplification in period js generator
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-05-06 03:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js	2014-05-06 04:09:19 +0000
@@ -102,7 +102,7 @@
  * @param options Additional options, will be merged with the defaults
  */
 dhis2.period.DatePicker.prototype.createRangedInstance = function( fromEl, toEl, fromIso, options ) {
-  var mergedOptions = $.extend({}, this.defaults, options);
+  var mergedOptions = $.extend({}, this.defaults, options || {});
 
   var $fromEl = $(fromEl);
   var $toEl = $(toEl);
@@ -150,13 +150,8 @@
  * @constructor
  */
 dhis2.period.PeriodGenerator = function( calendar, format ) {
-  if( typeof calendar === 'undefined' ) {
-    calendar = dhis2.period.calendar;
-  }
-
-  if( typeof format === 'undefined' ) {
-    format = dhis2.period.DEFAULT_DATE_FORMAT;
-  }
+  calendar = calendar || dhis2.period.calendar;
+  format = format || dhis2.period.DEFAULT_DATE_FORMAT;
 
   $.extend(this, {
     calendar: calendar,