mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-18 23:46:36 +00:00
Embrace Snowflake as first class citizen
This commit is contained in:
@@ -5,12 +5,6 @@ namespace DiscordChatExporter.Domain.Internal.Extensions
|
||||
{
|
||||
internal static class DateExtensions
|
||||
{
|
||||
public static string ToSnowflake(this DateTimeOffset dateTime)
|
||||
{
|
||||
var value = ((ulong) dateTime.ToUnixTimeMilliseconds() - 1420070400000UL) << 22;
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
public static string ToLocalString(this DateTimeOffset dateTime, string format) =>
|
||||
dateTime.ToLocalTime().ToString(format, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ namespace DiscordChatExporter.Domain.Internal.Extensions
|
||||
{
|
||||
internal static class GenericExtensions
|
||||
{
|
||||
public static TOut Pipe<TIn, TOut>(this TIn input, Func<TIn, TOut> transform) => transform(input);
|
||||
|
||||
public static T? NullIf<T>(this T value, Func<T, bool> predicate) where T : struct =>
|
||||
!predicate(value)
|
||||
? value
|
||||
|
||||
Reference in New Issue
Block a user