[backend/masto-client] Fix datetime string handling
This commit is contained in:
parent
b5a63fd301
commit
8ca64f5d11
4 changed files with 11 additions and 4 deletions
|
@ -74,8 +74,8 @@ public class NoteRenderer(
|
|||
Renote = renote, //TODO: check if it's a pure renote
|
||||
Quote = renote, //TODO: see above
|
||||
ContentType = "text/x.misskeymarkdown",
|
||||
CreatedAt = note.CreatedAt.ToString("O")[..^5],
|
||||
EditedAt = note.UpdatedAt?.ToString("O")[..^5],
|
||||
CreatedAt = note.CreatedAt.ToStringMastodon(),
|
||||
EditedAt = note.UpdatedAt?.ToStringMastodon(),
|
||||
RepliesCount = note.RepliesCount,
|
||||
RenoteCount = note.RenoteCount,
|
||||
FavoriteCount = 0, //FIXME
|
||||
|
|
|
@ -26,7 +26,7 @@ public class NotificationRenderer(NoteRenderer noteRenderer, UserRenderer userRe
|
|||
Type = Notification.EncodeType(notification.Type),
|
||||
Note = note,
|
||||
Notifier = notifier,
|
||||
CreatedAt = notification.CreatedAt.ToString("O")[..^5]
|
||||
CreatedAt = notification.CreatedAt.ToStringMastodon()
|
||||
};
|
||||
|
||||
return res;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
|||
Acct = acct,
|
||||
FullyQualifiedName = $"{user.Username}@{user.Host ?? config.Value.AccountDomain}",
|
||||
IsLocked = user.IsLocked,
|
||||
CreatedAt = user.CreatedAt.ToString("O")[..^5],
|
||||
CreatedAt = user.CreatedAt.ToStringMastodon(),
|
||||
FollowersCount = user.FollowersCount,
|
||||
FollowingCount = user.FollowingCount,
|
||||
StatusesCount = user.NotesCount,
|
||||
|
|
7
Iceshrimp.Backend/Core/Extensions/DateTimeExtensions.cs
Normal file
7
Iceshrimp.Backend/Core/Extensions/DateTimeExtensions.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Iceshrimp.Backend.Core.Extensions;
|
||||
|
||||
public static class DateTimeExtensions {
|
||||
public static string ToStringMastodon(this DateTime dateTime) {
|
||||
return dateTime.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK");
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue