mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
Large refactor and project restructuring
This commit is contained in:
parent
c10e197c39
commit
6d5004bf54
71 changed files with 1664 additions and 1607 deletions
24
PluralKit.Core/Utils/DateTimeFormats.cs
Normal file
24
PluralKit.Core/Utils/DateTimeFormats.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using NodaTime;
|
||||
using NodaTime.Text;
|
||||
|
||||
namespace PluralKit.Core {
|
||||
public static class DateTimeFormats
|
||||
{
|
||||
public static IPattern<Instant> TimestampExportFormat = InstantPattern.ExtendedIso;
|
||||
public static IPattern<LocalDate> DateExportFormat = LocalDatePattern.CreateWithInvariantCulture("yyyy-MM-dd");
|
||||
|
||||
// We create a composite pattern that only shows the two most significant things
|
||||
// eg. if we have something with nonzero day component, we show <x>d <x>h, but if it's
|
||||
// a smaller duration we may only bother with showing <x>h <x>m or <x>m <x>s
|
||||
public static IPattern<Duration> DurationFormat = new CompositePatternBuilder<Duration>
|
||||
{
|
||||
{DurationPattern.CreateWithInvariantCulture("s's'"), d => true},
|
||||
{DurationPattern.CreateWithInvariantCulture("m'm' s's'"), d => d.Minutes > 0},
|
||||
{DurationPattern.CreateWithInvariantCulture("H'h' m'm'"), d => d.Hours > 0},
|
||||
{DurationPattern.CreateWithInvariantCulture("D'd' h'h'"), d => d.Days > 0}
|
||||
}.Build();
|
||||
|
||||
public static IPattern<LocalDateTime> LocalDateTimeFormat = LocalDateTimePattern.CreateWithInvariantCulture("yyyy-MM-dd HH:mm:ss");
|
||||
public static IPattern<ZonedDateTime> ZonedDateTimeFormat = ZonedDateTimePattern.CreateWithInvariantCulture("yyyy-MM-dd HH:mm:ss x", DateTimeZoneProviders.Tzdb);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue