js check for new period