_createBoundDate sets lowerBoundEd one day later for single-day calendar, should only be for instant

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major
    • 3.2.0
    • Affects Version/s: 3.1.2
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Current Result

      calendar.wpd:3100 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'firstChild')
          at init._createItemsData (calendar.wpd:3100:19)
          at init.items (calendar.wpd:3001:27)
          at init.setItems (zk.wpd:9781:15)
          at Function._set2 (zk.wpd:10857:38)
          at setter.func (zk.wpd:21710:18)
          at init.set (zk.wpd:21744:28)
          at setAttr (zk.wpd:31274:15)
          at Object.setAttrs (zk.wpd:31293:11)
          at doProcess (zk.wpd:29399:10)
          at doCmdsNow (zk.wpd:29518:11)
      

      Expected Result

      no error when creating items

      Debug Information

      calendar.Item.prototype._createBoundTime adds one day to the lowerBoundEd of all items located in the same calendar day.

      This causes the node._afterOffset value to be too small by 1

      causes the _resetDayPosition function to create one fewer empty <td> for empty days after the item.

      Workaround

      <script><![CDATA[ 
      	zk.afterLoad("calendar", function () {
      	    var _xItem = {};
      	    zk.override(calendar.Item.prototype, _xItem, {
      	    	_createBoundTime: function (node, bd, ed) {
      	    		//have findBoundTime_ function
      	    		if (this.findBoundTime_) {
      	    			var time = this.findBoundTime_(bd, ed);
      	    			bd = time.bd;
      	    			ed = time.ed;
      	    		}
      	    		node.upperBoundBd = this._setBoundDate(bd); // earliest
      	    		if (this._isDayItem()) return;
      	    		if (calUtil.isTheSameDay(bd, ed) && bd.getHours() == ed.getHours() && bd.getMinutes() == ed.getMinutes() && bd.getSeconds() == ed.getSeconds()){
      	    			node.lowerBoundEd = calUtil.addDay(new Date(ed), 1);
      	    		}else{
      	    			node.lowerBoundEd = this._setBoundDate(ed, true); // latest
      	    		}
      	    	}
      	     });
      	});
      ]]></script>
      

            Assignee:
            hawk
            Reporter:
            MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: