mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Replace DateTime::parse with UnixDateTime::parse
Replace LibCore::DateTime::parse with UnixDateTime::parse. Add conversion from UTC to local time zone.
This commit is contained in:
parent
5f12d34d13
commit
27dfaea32f
Notes:
github-actions[bot]
2025-09-30 10:40:34 +00:00
Author: https://github.com/tomaszstrejczek
Commit: 27dfaea32f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5167
Reviewed-by: https://github.com/R-Goc
Reviewed-by: https://github.com/gmta ✅
1 changed files with 3 additions and 5 deletions
|
@ -18,7 +18,6 @@
|
|||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGC/RootVector.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
|
@ -385,10 +384,9 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
|
|||
|
||||
// NOTE: Non-standard: Pull out the Last-Modified header for use in the lastModified property.
|
||||
if (auto maybe_last_modified = navigation_params.response->header_list()->get("Last-Modified"sv.bytes()); maybe_last_modified.has_value()) {
|
||||
auto last_modified_datetime = Core::DateTime::parse("%a, %d %b %Y %H:%M:%S %Z"sv, maybe_last_modified.value());
|
||||
document->m_last_modified = last_modified_datetime.has_value()
|
||||
? AK::UnixDateTime::from_seconds_since_epoch(last_modified_datetime.value().timestamp())
|
||||
: Optional<AK::UnixDateTime>();
|
||||
// rfc9110, 8.8.2: The Last-Modified header field must be in GMT time zone.
|
||||
// document->m_last_modified is in local time zone.
|
||||
document->m_last_modified = AK::UnixDateTime::parse("%a, %d %b %Y %H:%M:%S GMT"sv, maybe_last_modified.value(), true);
|
||||
}
|
||||
|
||||
// NOTE: Non-standard: Pull out the Content-Language header to determine the document's language.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue