Javascript date calculation error demo