Kanban Overdue info is displayed with 1 hour delay

Hi JMIX team,

We found that the overdue information is displayed with 1 hour difference.

Currently is 11:49 if the due date is set to 11:00 no delayed info is displayed in the kanban.

image

image

If we change to 10:00 the overdue information is displayed in the Kanban green rectangle.

image

image

We gave Javascript code (smart.kanban.js) to ChatGpt and we asked where the mistake is, the answer is listed below, in case this will help.

:red_circle: Where the problem is

The issue is in this comparison:

s.getTime() < (new Date).getTime()

At first glance it looks fine, but earlier in the code s is manually shifted for timezone:

s.setTime(
  s.getTime() - s.getTimezoneOffset() * 60 * 1000
);

So you end up comparing:

  • smanually timezone-adjusted
  • new Date()native local time

These two values are no longer in the same time reference.

:pushpin: Result: the comparison is off by exactly the timezone offset
(typically 1 hour in most European timezones).

:brain: Why the overdue warning appears 1 hour early/late

JavaScript already stores Date values internally in UTC and converts them to local time automatically.

By subtracting getTimezoneOffset() manually, the code effectively:

  • Converts the date into a “fake local UTC”
  • While new Date() remains true local time

This creates a fixed offset error, which is why the overdue flag only changes after one hour.

:no_entry_sign: The problematic line

This is the root cause:

s.setTime(s.getTime() - s.getTimezoneOffset() * 60 * 1000);

It breaks consistency in all later comparisons.

:white_check_mark: Correct solutions (choose one)

:white_check_mark: Option 1 — Remove manual timezone adjustment (recommended)

Simply remove the timezone correction:

// ❌ remove this
s.setTime(
  s.getTime() - s.getTimezoneOffset() * 60 * 1000
);

JavaScript will handle local time correctly by itself.

:heavy_check_mark: Cleanest solution
:heavy_check_mark: Prevents future bugs
:heavy_check_mark: Matches Smart UI internal behavior

:white_check_mark: Option 2 — Adjust now the same way

If you must keep the adjustment on s, then also adjust the current time:

const now = new Date();
now.setTime(
  now.getTime() - now.getTimezoneOffset() * 60 * 1000
);

const isOverdue =
  s.getTime() < now.getTime() &&
  a[t.progress] !== 100;

:pushpin: This keeps both values in the same timezone reference.

:brain: Final takeaway

The overdue warning is wrong because:

  • One date is manually timezone-shifted
  • The other (new Date()) is not
  • This causes a 1-hour offset bug

:point_right: Removing the manual timezone correction is the correct fix in most cases.

We could try these options but we are not sure how to overwrite this file. ¿Any hint?