Fixing bug in safari (js date bug)