// Copyright © Selmo Technology GmbH. All Rights Reserved

using System.Globalization;

namespace SelmoStudio.Hmi.Server.SelmoHmi.Shared.Helpers
{
    internal class DateTimeFormatter
    {
        internal static string CurrentUICultureDateFormat =>
            CultureInfo.DefaultThreadCurrentUICulture?.DateTimeFormat.ShortDatePattern ??
                CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern;

        internal static string CurrentUICultureTimeFormat =>
            CultureInfo.DefaultThreadCurrentUICulture?.DateTimeFormat.ShortTimePattern ??
                CultureInfo.CurrentUICulture.DateTimeFormat.ShortTimePattern;

        internal static string FormatDateTime(DateTime date)
        {
            return $"{date.ToShortDateString().ToString(CultureInfo.DefaultThreadCurrentUICulture)} " +
                $"{date.ToLongTimeString().ToString(CultureInfo.DefaultThreadCurrentUICulture)}";
        }
    }
}