using System;

namespace InABox.Core
{
    public class DFLayoutTimeStampFieldProperties : DFLayoutFieldProperties<DateTime>
    {
        public override string FormatValue(object? value)
        {
            return string.Format("{0:mm HH dd MMM yy}", value);
        }

        public override object? ParseValue(object? value)
        {
            if (value is DateTime)
                return value;
            if (DateTime.TryParse(value as string, out var result))
                return result;
            return null;
        }
    }
}