fixing seconds to ms bug in js