LANCommander/LANCommander.Launcher/Converters/DateTimeOffsetToTimeStringConverter.cs
Pat Hartl b183e4b18c Remove old launcher, rename Avalonia launcher
Also adds ARM builds for Linux + Windows launcher
2026-06-06 05:49:24 -05:00

21 lines
755 B
C#

using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace LANCommander.Launcher.Converters;
/// <summary>Formats a DateTimeOffset as a short local-time string (HH:mm).</summary>
public class DateTimeOffsetToTimeStringConverter : IValueConverter
{
public static readonly DateTimeOffsetToTimeStringConverter Instance = new();
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is DateTimeOffset dto)
return dto.LocalDateTime.ToString("HH:mm", culture);
return string.Empty;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
=> throw new NotSupportedException();
}