namespace HistoryView.Converters;

public class DateTimeToString : IValueConverter
{
    public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not DateTime dataTime)
            return default;

        if (parameter is not string para)
            return dataTime.ToString("yyyy-MM-dd HH:mm:ss");


        return para switch
        {
            "Date" => dataTime.ToString("yyyy-MM-dd"),
            "Time" => dataTime.ToString("HH:mm:ss"),
            _ => dataTime.ToString("yyyy-MM-dd HH:mm:ss"),
        };


    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
