fixing date issues with javascript