﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Humanizer;
using Torshify;

namespace Picofy.Converters
{
    public class DateTimeRelative : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (value == null ? "The Past" : ((DateTime) value).Humanize());
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (value == null ? DateTime.MinValue : value.ToString().DehumanizeTo<DateTime>());
        }
    }
}
