[Solved] How to make JS date respect local timezone?


Assuming that seconds is a unix epoch (UTC), you should just use

function date_str(seconds) {
    var dt = new Date(seconds*1000);
    console.log(dt);
    …

instead. The get…() methods will respect the local timezone. If you don’t want that, you should use the getUTC…() equivalents.

0

solved How to make JS date respect local timezone?