2

I use Moment.js in a planning application and I observe unexpected behaviors: the software calculates bad hours (+/-1hour spring/winter) when i'm working before the day of the time change (today for sunday) but not when it is the day (the same action on sunday is ok). It seems to anticipate the change when it's not what I want.

I tried to use the extension .utc () with no success. Thanks for all suggestion.

// return hour from x position
function getHeure(x) {
    var dd = moment(heure0, "DD/MM/YYYY HH:mm:ss"); // heure0 contain day/hour of start
    var gt = moment(dd).add(parseInt(x / granul),'m') // 'x' is the x point in planning, 'granul' the ratio of min/px
if (dd.date()==27 && dd.month()==9) gt.add(1,'hours')   // current workaround for France in 2019...
    return gt
}

1 Answers1

0

I think you can follow the same approach as this question.

https://stackoverflow.com/a/11888430/3292394

I have used the solution above and it works perfectly.

Regards, user3292394

user3292394
  • 609
  • 2
  • 11
  • 24