Fixing Date object bug in old Safari and IE