fixed invalid date js error in safari