mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
Everywhere: Replace DateTime::to_string() with UnixDateTime::to_string()
Replace LibCore::DateTime::to_string() with AK::UnixDateTime::to_string(). Remove unncessary #include <LibCore/DateTime.h>.
This commit is contained in:
parent
8f8e51b1fc
commit
6fb2be96bf
Notes:
github-actions[bot]
2025-06-20 00:44:11 +00:00
Author: https://github.com/tomaszstrejczek
Commit: 6fb2be96bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5096
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/R-Goc
Reviewed-by: https://github.com/gmta
13 changed files with 25 additions and 30 deletions
|
@ -15,7 +15,9 @@
|
|||
#include <AK/InsertionSort.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#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>
|
||||
|
@ -373,8 +375,12 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
|
|||
document->m_window = window;
|
||||
|
||||
// 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())
|
||||
document->m_last_modified = Core::DateTime::parse("%a, %d %b %Y %H:%M:%S %Z"sv, maybe_last_modified.value());
|
||||
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>();
|
||||
}
|
||||
|
||||
// NOTE: Non-standard: Pull out the Content-Language header to determine the document's language.
|
||||
if (auto maybe_http_content_language = navigation_params.response->header_list()->get("Content-Language"sv.bytes()); maybe_http_content_language.has_value()) {
|
||||
|
@ -3070,7 +3076,7 @@ String Document::last_modified() const
|
|||
if (m_last_modified.has_value())
|
||||
return MUST(m_last_modified.value().to_string(format_string));
|
||||
|
||||
return MUST(Core::DateTime::now().to_string(format_string));
|
||||
return MUST(AK::UnixDateTime::now().to_string(format_string));
|
||||
}
|
||||
|
||||
Page& Document::page()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue