✅ How to sum datetimeoffset and timespan?
I have following structure:
I would like to get expiration time by sum timestamp and ttl
I tried this:
but it's not correct
[JsonProperty( PropertyName = "timestamp" )]
[JsonRequired]
public DateTimeOffset Timestamp { get; set; }
[JsonProperty( PropertyName = "ttl" )]
public TimeSpan? Ttl { get; set; }
[JsonProperty( PropertyName = "expires_at" )]
public DateTime ExpiresAt { get; set; } [JsonProperty( PropertyName = "timestamp" )]
[JsonRequired]
public DateTimeOffset Timestamp { get; set; }
[JsonProperty( PropertyName = "ttl" )]
public TimeSpan? Ttl { get; set; }
[JsonProperty( PropertyName = "expires_at" )]
public DateTime ExpiresAt { get; set; } I would like to get expiration time by sum timestamp and ttl
I tried this:
[JsonProperty( PropertyName = "expires_at" )]
public DateTime ExpiresAt => Ttl.HasValue
? DateTime.Now.Add( Ttl.Value )
: DateTime.MaxValue;[JsonProperty( PropertyName = "expires_at" )]
public DateTime ExpiresAt => Ttl.HasValue
? DateTime.Now.Add( Ttl.Value )
: DateTime.MaxValue;but it's not correct