Skip to content

Commit

Permalink
Make time nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Nov 6, 2023
1 parent e188647 commit fbef1a0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/FishyFlip/Models/FrameCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ public FrameCommit(CBORObject obj)
this.Ops = obj["ops"]?.Values.Select(n => new Ops(n)).ToArray();
this.Seq = obj["seq"].AsInt32();
this.Blocks = obj["blocks"]?.GetByteString();
#pragma warning disable CS0618 // 型またはメンバーが旧型式です
this.Prev = obj["prev"].ToCid();
#pragma warning restore CS0618 // 型またはメンバーが旧型式です
#pragma warning disable CS0618
this.Prev = obj["prev"]?.ToCid();
#pragma warning restore CS0618
this.Rev = obj["rev"]?.AsString();
this.Since = obj["since"]?.AsString();
this.Commit = obj["commit"].ToCid();
this.Repo = obj["repo"] is not null ? ATDid.Create(obj["repo"].AsString()) : null;
this.Handle = obj["handle"] is not null ? ATHandle.Create(obj["handle"].AsString()) : null;
this.Rebase = obj["rebase"]?.AsBoolean() ?? false;
this.TooBig = obj["tooBig"]?.AsBoolean() ?? false;
this.Time = DateTime.Parse(obj["time"].AsString());
var time = obj["time"]?.AsString();
if (!string.IsNullOrEmpty(time))
{
this.Time = DateTime.Parse(time);
}
}

/// <summary>
Expand Down Expand Up @@ -63,7 +67,7 @@ public FrameCommit(CBORObject obj)
/// <summary>
/// Gets the date time of the frame.
/// </summary>
public DateTime Time { get; }
public DateTime? Time { get; }

/// <summary>
/// Gets the CBOR blocks.
Expand Down

0 comments on commit fbef1a0

Please sign in to comment.