Fix Date conversion between Foundation and JavaScript (off by a factor 1000). Update date test.