namespace CrazyStudio.Core.Common
{
    public class DateTimeUtil
    {
        public static DateTimeUtil Instance
        {
            get
            {
                return SingletonProvider<DateTimeUtil>.Instance;
            }
        }

        [Obsolete]
        public static DateTime ConvertJsTime(long dt)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            long lTime = long.Parse(dt + "0000");
            TimeSpan toNow = new TimeSpan(lTime);
            DateTime dtResult = dtStart.Add(toNow);
            return dtResult;
        }

        [Obsolete]
        public static long ToJsTime(DateTime dtResult)
        {
            DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0, 0));
            //intResult = (time- startTime).TotalMilliseconds;
            long t = (dtResult.Ticks - startTime.Ticks) / 10000;//除10000调整为13位
            return t;
        }

        public static string NumericToWeekString(int input)
        {
            string result = input switch
            {
                1 => "周一",
                2 => "周二",
                3 => "周三",
                4 => "周四",
                5 => "周五",
                6 => "周六",
                0 => "周日",
                _ => "日期错误",
            };
            return result;
        }
    }
}
