using System; using System.ComponentModel.DataAnnotations; namespace Kreta.Naplo.Domain.V3.Utility.ValidationAttributes { [AttributeUsage(AttributeTargets.Property)] internal sealed class ShortDateTimeAttribute : ValidationAttribute { public override bool IsValid(object value) { DateTime? timePropertyValue = value as DateTime?; return !timePropertyValue.HasValue || timePropertyValue.Value - timePropertyValue.Value.Date == new TimeSpan(0); } } }