Results 1 to 3 of 3

Thread: Ext.Date.add preventDst bug

  1. #1
    Sencha Premium User
    Join Date
    Dec 2015
    Posts
    18

    Default Ext.Date.add preventDst bug

    The default value of `preventDst` is false, according to docs. Right? Right, in Ext 6.7.0.

    Now, guess the result of this:
    Code:
    const startDate = new Date('10/1/2019 00:00');
    const added27Days = Ext.Date.add(startDate, Ext.Date.DAY, 27);
    const added648Hours = Ext.Date.add(startDate, Ext.Date.HOUR, 27*24); //It is 27 days, yes
    console.log('It should be true, but ', Ext.Date.isEqual(added27Days, added648Hours));
    Oh, wow. Let's break this down.
    You broke a documented behaviour without any notification in a minor version upgrade.
    It is still behaves badly in 7.0.0.
    The code caused the break is the following
    Code:
    if (preventDstAdjust === false) {
      d.setTime(d.getTime() + value * 24 * 60 * 60 * 1000);
    } else {
      d.setDate(d.getDate() + value);
    }
    Nice?
    Let me guess the reason, the date time picker was broken badly, it had two October 27th this year(the day on DST change occurring always doubled), but instead of fixing date time picker to use your function as you documented(pass true as the last argument), you conditionally broke a core utility function without notification. Seriously asking, why are you doing this? This is not the first or the second time you make breaking change in minor version upgrades, but what kind of "fix" is that?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    I'm not sure what caused this change but the "fix" is not a fix. Since the argument is boolean, truthy vs falsy checking like the other cases in that switch are enough.

    I've logged a request to have them open a bug to fix this and pointed out there may be other issues that will need to be resolved from reverting this code.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    They opened a bug for this: EXTJS-28680
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •