27 lines
807 B
C#
27 lines
807 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
namespace BackgroundBuilder.Converters
|
|
{
|
|
public class DateNoDotConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is DateTime dt)
|
|
{
|
|
// get "MMM" then TrimEnd('.'):
|
|
string month = culture
|
|
.DateTimeFormat
|
|
.GetAbbreviatedMonthName(dt.Month)
|
|
.TrimEnd('.');
|
|
return $"{dt:dd}/{month}";
|
|
}
|
|
return value;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> throw new NotImplementedException();
|
|
}
|
|
}
|