1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

project_manager: Display last edited time using local timezone instead of UTC

This commit is contained in:
nobbele
2025-03-09 20:55:20 +01:00
parent b5bdb88062
commit acc8fbee34
2 changed files with 11 additions and 1 deletions

View File

@@ -869,7 +869,7 @@ void ProjectList::_create_project_item_control(int p_index) {
hb->set_tags(item.tags, this);
hb->set_unsupported_features(item.unsupported_features.duplicate());
hb->set_project_version(item.project_version);
hb->set_last_edited_info(!item.missing ? Time::get_singleton()->get_datetime_string_from_unix_time(item.last_edited, true) : TTR("Missing Date"));
hb->set_last_edited_info(item.get_last_edited_string());
hb->set_is_favorite(item.favorite);
hb->set_is_missing(item.missing);

View File

@@ -31,6 +31,7 @@
#pragma once
#include "core/io/config_file.h"
#include "core/os/time.h"
#include "scene/gui/box_container.h"
#include "scene/gui/scroll_container.h"
@@ -161,6 +162,15 @@ public:
_FORCE_INLINE_ bool operator==(const Item &l) const {
return path == l.path;
}
String get_last_edited_string() const {
if (missing) {
return TTR("Missing Date");
}
OS::TimeZoneInfo tz = OS::get_singleton()->get_time_zone_info();
return Time::get_singleton()->get_datetime_string_from_unix_time(last_edited + tz.bias * 60, true);
}
};
private: