The property lastModified of the document object (https://developer.mozilla.org/en/DOM/document.lastModified) appears not to be supported by htmlunit.
The files in attachment add a test case and a patch to add support for document.lastModified
(the diffs are against a (very) old version of htmlunit, sorry, but it should be easy to adapt them to the current version)
test case for document.lastModified
patch to add support for document.lastModified
Now fixed in SVN.
I see that you attached patches now that I've fixed it :-(
I don't agree on your test case: the problem is that the date string returned depends from the current time zone and therefore you have to take it into account to have a test that runs everywhere.
I've taken the Date header into account as well.
In Firefox 3 (at least), document.lastModified doesn't return an empty string if no date header is present: it returns the current time.
Please reopen with a test case if you don't agree with my implementation.
The format of the date provided in Marco's test case was correct, though I agree that he did neglected to take the time zone into account. Your implementation is incorrect as it generates the date string in the wrong format, as I've detailed in bug #2919853. My test case should resolve the timezone issue, as I didn't bother to validate the actual date and time returned; I just validate the format, since I couldn't think of a good way to check the specific date and time without actually implementing the lastModified property in my unit test.