Fixes U4-2822 Datepicker throws "Specified cast is not valid" when saving through API
This commit is contained in:
@@ -65,12 +65,12 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
return Date.Value;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(VarChar))
|
||||
if(string.IsNullOrEmpty(VarChar) == false)
|
||||
{
|
||||
return VarChar;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(Text))
|
||||
if(string.IsNullOrEmpty(Text) == false)
|
||||
{
|
||||
return Text;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,17 @@ namespace umbraco.editorControls.datepicker
|
||||
|
||||
public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
|
||||
{
|
||||
if (Value != null && Value.ToString() != "")
|
||||
return d.CreateTextNode(((DateTime) Value).ToString("s"));
|
||||
else
|
||||
return d.CreateTextNode("");
|
||||
if (Value != null && Value.ToString() != "")
|
||||
{
|
||||
if(Value is DateTime)
|
||||
return d.CreateTextNode(((DateTime) Value).ToString("s"));
|
||||
|
||||
DateTime convertedDate;
|
||||
if (DateTime.TryParse(Value.ToString(), out convertedDate))
|
||||
return d.CreateTextNode(convertedDate.ToString("s"));
|
||||
}
|
||||
|
||||
return d.CreateTextNode("");
|
||||
}
|
||||
|
||||
public override void MakeNew(int PropertyId)
|
||||
|
||||
Reference in New Issue
Block a user