the bug was that time from server is in UTC format, and our time is in local format, so it needed to be shifted back to UTC. oddly enough .toUtc() method didn't work