updated Javascript date method