using System;
using Core.Util.Common;
namespace Core.Util.Extension
{
    /// 
    ///     时间帮助扩展类
    /// 
    public static class DateTimeExtension
    {
        private static readonly DateTime MinDate = new DateTime(1970, 1, 1);
        private static readonly DateTime MaxDate = new DateTime(9999, 12, 31, 23, 59, 59, 999);
        /// 
        /// 当前时间是否有效范围之内
        /// 
        /// 
        /// 
        public static bool IsValid(this DateTime target)
        {
            return (target >= MinDate) && (target <= MaxDate);
        }
        /// 时间日期转为yyyy-MM-dd HH:mm:ss完整字符串,支持指定最小时间的字符串
        public static string ToFullString(this DateTime value, string emptyValue = null)
        {
            return new DefaultConvert().ToFullString(value, emptyValue);
        }
        /// 时间日期转为指定格式字符串
        public static string ToString(this DateTime value, string format, string emptyValue)
        {
            return new DefaultConvert().ToString(value, format, emptyValue);
        }
    }
}