JS: fixing calendar issue