public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value == null) { return(null); } if (value is LocalDate res) { return(res); } if (value is DateTime d && d == d.Date) { return(LocalDate.FromDateTime(d)); } if (value is string s) { var r = _pattern.WithCulture(culture ?? CultureInfo.InvariantCulture).Parse(s); if (r.Success) { return(r.Value); } // little hack, not the finest, but should work if (DateTime.TryParse(s, out var dt) && dt.Date == dt) { return(LocalDate.FromDateTime(dt)); } } return(base.ConvertFrom(context, culture, value)); }