You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Connected.Extensions;
|
|
|
|
|
|
|
|
|
|
namespace Connected;
|
|
|
|
|
|
|
|
|
|
public class IsoDateConverter : Converter<DateTime, string>
|
|
|
|
|
{
|
|
|
|
|
protected override string ConvertValue(DateTime value) => value.ToIsoDateString();
|
|
|
|
|
|
|
|
|
|
protected override DateTime ConvertValueBack(string? value) => DateTime.TryParse(value, out var dateTime) ? dateTime : DateTime.MinValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class NullableIsoDateConverter : Converter<DateTime?, string?>
|
|
|
|
|
{
|
|
|
|
|
protected override string? ConvertValue(DateTime? value) => value?.ToIsoDateString();
|
|
|
|
|
|
|
|
|
|
protected override DateTime? ConvertValueBack(string? value) => DateTime.TryParse(value, out var dateTime) ? dateTime : null;
|
|
|
|
|
}
|