Skip to content

Commit

Permalink
Use Universal Time Format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Nov 7, 2024
1 parent 96ca6f1 commit f3854d3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Latest Changelog

- Fixed 'Distorted Yan' appearing as ???????????
- Updated Japanese localization (by @nomlasvrc)
- Updated Simplifed Chinese localization (by @Fallen-ice)
- Date list now sorts using Universal Time. This prevents unwanted behaviour when 'Daylight Saving' event occurs.
4 changes: 3 additions & 1 deletion Models/History.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ internal void Export()
public string Guid = string.Empty;
public string Name = string.Empty;
public DateTime Timestamp = DateTime.MinValue;
[JsonIgnore]
public DateTime UniversalTime => Timestamp.ToUniversalTime();
public bool IsCustom = false;

public string? DisplayName = string.Empty;
Expand Down Expand Up @@ -211,7 +213,7 @@ public int CompareTo(History? other)

if (!IsCustom && other.IsCustom) return -1;
if (IsCustom && !other.IsCustom) return 1;
return Timestamp.CompareTo(other.Timestamp);
return UniversalTime.CompareTo(other.UniversalTime);
}
}
}
2 changes: 1 addition & 1 deletion Models/SaveData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private int FindIndex(History a)
if (a.IsCustom && !b.IsCustom) return i;
if (b.IsCustom && !a.IsCustom) continue;

if (b.Timestamp < a.Timestamp)
if (b.UniversalTime < a.UniversalTime)
return i;
}

Expand Down
2 changes: 1 addition & 1 deletion Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ private void FirstImport() {
AddKey(h, i);
if (h.IsCustom) continue;

if (temp == null || temp.Timestamp < h.Timestamp) temp = h;
if (temp == null || temp.UniversalTime < h.UniversalTime) temp = h;
}

if (Settings.Get.AutoCopy) {
Expand Down

0 comments on commit f3854d3

Please sign in to comment.