Skip to content

Commit 964ec24

Browse files
committed
Changing RichTextDate.Timestamp to a long and adding Date wrapper property
Resolves #239
1 parent 78af498 commit 964ec24

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

SlackNet/Blocks/RichTextBlock.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using Newtonsoft.Json;
34

45
namespace SlackNet.Blocks;
@@ -93,7 +94,15 @@ public class RichTextUserGroup() : RichTextSectionElement("usergroup")
9394
public class RichTextDate() : RichTextSectionElement("date")
9495
{
9596
public string Text { get; set; }
96-
public string Timestamp { get; set; }
97+
public long Timestamp { get; set; }
98+
99+
[JsonIgnore]
100+
public DateTime? Date
101+
{
102+
get => Timestamp.ToDateTime();
103+
set => Timestamp = value?.ToTimestampNumber() ?? 0;
104+
}
105+
97106
/// <summary>
98107
/// See https://api.slack.com/reference/surfaces/formatting#date-formatting for more information.
99108
/// </summary>

0 commit comments

Comments
 (0)