fix: Convert timestamps to local time in date formatting across components

This commit is contained in:
2025-01-05 10:31:51 +08:00
parent 2a6866fb26
commit 98be888d3d
4 changed files with 6 additions and 6 deletions

View File

@@ -127,7 +127,7 @@ class GalleryInfoDesktop extends StatelessWidget {
"${i18n.posted}${i18n.colon}",
DateFormat.yMd(locale)
.add_jms()
.format(gData.meta.posted),
.format(gData.meta.posted.toLocal()),
maxLines: 2,
minLines: 1,
fontSize: 12,

View File

@@ -32,7 +32,7 @@ class GalleryInfoDetail extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Rate(meta.rating, fontSize: 14),
Text(DateFormat.yMd(locale).add_jms().format(meta.posted),
Text(DateFormat.yMd(locale).add_jms().format(meta.posted.toLocal()),
style: TextStyle(color: cs.secondary)),
],
),

View File

@@ -58,11 +58,11 @@ class SessionCard extends StatelessWidget {
final expiredTime =
DateFormat.yMd(MainApp.of(context).lang.toLocale().toString())
.add_jms()
.format(token.expired);
.format(token.expired.toLocal());
final lastUsed =
DateFormat.yMd(MainApp.of(context).lang.toLocale().toString())
.add_jms()
.format(token.lastUsed);
.format(token.lastUsed.toLocal());
return Card.outlined(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),

View File

@@ -383,8 +383,8 @@ class _TaskPage extends State<TaskPage> {
? Divider(indent: indent, endIndent: endIndent)
: Container(),
posted != null
? _KeyValue(
i18n.posted, DateFormat.yMd(locale).add_jms().format(posted),
? _KeyValue(i18n.posted,
DateFormat.yMd(locale).add_jms().format(posted.toLocal()),
fontSize: 16)
: Container(),
Divider(indent: indent, endIndent: endIndent),