fix: merged timeline orderby localtime (#22371)

* chore: refactor dateFmt to truncateDate

* fix: merged timeline orderby localtime

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-09-29 20:23:40 +05:30 committed by GitHub
parent bea116e1b9
commit fea5e6783c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 7628 additions and 16 deletions

View file

@ -1,7 +1,7 @@
const int _maxMillisecondsSinceEpoch = 8640000000000000; // 275760-09-13
const int _minMillisecondsSinceEpoch = -62135596800000; // 0001-01-01
DateTime? tryFromSecondsSinceEpoch(int? secondsSinceEpoch) {
DateTime? tryFromSecondsSinceEpoch(int? secondsSinceEpoch, {bool isUtc = false}) {
if (secondsSinceEpoch == null) {
return null;
}
@ -12,7 +12,7 @@ DateTime? tryFromSecondsSinceEpoch(int? secondsSinceEpoch) {
}
try {
return DateTime.fromMillisecondsSinceEpoch(milliSeconds);
return DateTime.fromMillisecondsSinceEpoch(milliSeconds, isUtc: isUtc);
} catch (e) {
return null;
}