fix date time display (#2983)
* fix date time display * Use ISO8601, fix nullability, improve validation * Should probably override all of them to be consistent * use local time format here Co-authored-by: James Groom <OSSYoshiRulz+GitHub@gmail.com>
This commit is contained in:
parent
84b55d2af4
commit
77916cfa2c
src
BizHawk.Common
BizHawk.Emulation.Cores/Consoles
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace BizHawk.Common
|
||||
{
|
||||
public class BizDateTimeConverter : DateTimeConverter
|
||||
{
|
||||
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
|
||||
{
|
||||
if (value is not DateTime d || destinationType != typeof(string)) throw new NotSupportedException("can only do DateTime --> string");
|
||||
return d.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -163,6 +163,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
[DisplayName("RTC Initial Time")]
|
||||
[Description("The initial time of emulation. Only relevant when a game has an RTC chip and \"RTC Use Real Time\" is false.")]
|
||||
[DefaultValue(typeof(DateTime), "2010-01-01")]
|
||||
[TypeConverter(typeof(BizDateTimeConverter))]
|
||||
public DateTime RTCInitialTime { get; set; }
|
||||
|
||||
[DisplayName("Save Type")]
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
[DisplayName("Initial Time")]
|
||||
[Description("Initial time of emulation.")]
|
||||
[DefaultValue(typeof(DateTime), "2000-01-01")]
|
||||
[TypeConverter(typeof(BizDateTimeConverter))]
|
||||
public DateTime InitialTime
|
||||
{
|
||||
get => _initaltime;
|
||||
|
|
|
@ -88,10 +88,12 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
[DisplayName("Initial Time")]
|
||||
[Description("Initial time of emulation. Only relevant when UseRealTime is false.")]
|
||||
[DefaultValue(typeof(DateTime), "2010-01-01")]
|
||||
[TypeConverter(typeof(BizDateTimeConverter))]
|
||||
public DateTime InitialTime { get; set; }
|
||||
|
||||
[Description("Your birthdate. Stored in EEPROM and used by some games.")]
|
||||
[DefaultValue(typeof(DateTime), "1968-05-13")]
|
||||
[TypeConverter(typeof(BizDateTimeConverter))]
|
||||
public DateTime BirthDate { get; set; }
|
||||
|
||||
[Description("True to emulate a color system.")]
|
||||
|
|
Loading…
Reference in New Issue