[Framework] Add a DateTime property for CarrierJumpRequest DepartureTime (#119)

Refactored out the logic backing the JournalBase TimestampDateTime property so it can be used for any DateTime type property, providing a standardized json String -> DateTime conversion for any date-time property. Implemented as an `internal static` method on JournalBase so journal objects which inherit from JournalBase or don't inherit from it can use it.

Used this to provide a DepatureTimeDateTime on CarrierJumpRequest (this property was added in Update 14) and to implement the existing ExpiryDateTime on CurrentGoal.

From a quick search in the journal documentation, I don't see any other applications for this.
This commit is contained in:
F K 2023-08-14 08:05:00 -04:00 committed by GitHub
commit ff784b31d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 16 deletions

View file

@ -1,4 +1,6 @@
namespace Observatory.Framework.Files.Journal
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Journal
{
public class CarrierJumpRequest : JournalBase
{
@ -9,5 +11,10 @@
public string SystemName { get; init; }
public ulong SystemID { get; init; }
public string DepartureTime { get; init; }
[JsonIgnore]
public DateTime DepartureTimeDateTime {
get => ParseDateTime(DepartureTime);
}
}
}