allow to select a date & fix issue
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Billing
|
||||
{
|
||||
@@ -73,5 +74,45 @@ namespace Billing
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public static bool IsSameDay(DateTime day1, DateTime day2)
|
||||
{
|
||||
return day1.Year == day2.Year && day1.DayOfYear == day2.DayOfYear;
|
||||
}
|
||||
|
||||
public static DateTime FirstDay(DateTime date)
|
||||
{
|
||||
var week = date.DayOfWeek;
|
||||
if (week == DayOfWeek.Sunday)
|
||||
{
|
||||
return date;
|
||||
}
|
||||
return date.AddDays(-(int)week);
|
||||
}
|
||||
|
||||
public static BindableProperty Create<TResult, TOwner>(string name, TResult defaultValue = default, PropertyValueChanged<TResult, TOwner> propertyChanged = null)
|
||||
where TOwner : BindableObject
|
||||
{
|
||||
if (propertyChanged == null)
|
||||
{
|
||||
return BindableProperty.Create(name, typeof(TResult), typeof(TOwner), defaultValue: defaultValue);
|
||||
}
|
||||
return BindableProperty.Create(name, typeof(TResult), typeof(TOwner),
|
||||
defaultValue: defaultValue,
|
||||
propertyChanged: (obj, old, @new) =>
|
||||
{
|
||||
if (old != null && !(old is TResult))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (@new != null && !(@new is TResult))
|
||||
{
|
||||
return;
|
||||
}
|
||||
propertyChanged((TOwner)obj, (TResult)old, (TResult)@new);
|
||||
});
|
||||
}
|
||||
|
||||
public delegate void PropertyValueChanged<TResult, TOwner>(TOwner obj, TResult old, TResult @new);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user