Migrate to date/time format extension methods

This commit is contained in:
Ske
2020-06-21 16:05:04 +02:00
parent dcffbef805
commit d3cf382e3b
10 changed files with 40 additions and 36 deletions

View File

@@ -226,7 +226,7 @@ namespace PluralKit.Bot
if (zoneStr == null)
{
await ctx.Reply(
$"Your current system time zone is set to **{ctx.System.UiTz}**. It is currently **{DateTimeFormats.ZonedDateTimeFormat.Format(SystemClock.Instance.GetCurrentInstant().InZone(ctx.System.Zone))}** in that time zone. To change your system time zone, type `pk;s tz <zone>`.");
$"Your current system time zone is set to **{ctx.System.UiTz}**. It is currently **{SystemClock.Instance.GetCurrentInstant().FormatZoned(ctx.System)}** in that time zone. To change your system time zone, type `pk;s tz <zone>`.");
return;
}
@@ -235,7 +235,7 @@ namespace PluralKit.Bot
var currentTime = SystemClock.Instance.GetCurrentInstant().InZone(zone);
var msg = await ctx.Reply(
$"This will change the system time zone to **{zone.Id}**. The current time is **{DateTimeFormats.ZonedDateTimeFormat.Format(currentTime)}**. Is this correct?");
$"This will change the system time zone to **{zone.Id}**. The current time is **{currentTime.FormatZoned()}**. Is this correct?");
if (!await ctx.PromptYesNo(msg)) throw Errors.TimezoneChangeCancelled;
ctx.System.UiTz = zone.Id;
await _data.SaveSystem(ctx.System);