|
|
|
|
@ -23,10 +23,36 @@ public abstract class AbpDatePickerBaseTagHelperService<TTagHelper> : AbpTagHelp
|
|
|
|
|
where TTagHelper : AbpDatePickerBaseTagHelper<TTagHelper>
|
|
|
|
|
{
|
|
|
|
|
protected readonly Dictionary<Type,Func<object,string>> SupportedInputTypes = new() {
|
|
|
|
|
{typeof(string), o => DateTime.Parse((string)o).ToString("O")},
|
|
|
|
|
{typeof(DateTime), o => ((DateTime) o).ToString("O")},
|
|
|
|
|
{typeof(string), o =>
|
|
|
|
|
{
|
|
|
|
|
if(o is string s && DateTime.TryParse(s, out var dt))
|
|
|
|
|
{
|
|
|
|
|
return dt.ToString("O");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{typeof(DateTime), o =>
|
|
|
|
|
{
|
|
|
|
|
if(o is DateTime dt && dt != default)
|
|
|
|
|
{
|
|
|
|
|
return dt.ToString("O");
|
|
|
|
|
}
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{typeof(DateTime?), o => ((DateTime?) o)?.ToString("O")},
|
|
|
|
|
{typeof(DateTimeOffset), o => ((DateTimeOffset) o).ToString("O")},
|
|
|
|
|
{typeof(DateTimeOffset), o =>
|
|
|
|
|
{
|
|
|
|
|
if(o is DateTimeOffset dto && dto != default)
|
|
|
|
|
{
|
|
|
|
|
return dto.ToString("O");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{typeof(DateTimeOffset?), o => ((DateTimeOffset?) o)?.ToString("O")}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|