mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
📕 Document return values in DateTimeExtensions
This commit is contained in:
parent
2dab2f30bb
commit
4c30c8228b
@ -22,7 +22,8 @@
|
||||
/// </summary>
|
||||
/// <param name="date">The date from which to start.</param>
|
||||
/// <param name="asOf">The date at which to stop counting.</param>
|
||||
/// <returns>Returns the number of years since <paramref name="date"/> as of <paramref name="asOf"/>.</returns>
|
||||
/// <returns>Returns the integer number of years since <paramref name="date"/> as of
|
||||
/// <paramref name="asOf"/>.</returns>
|
||||
public static int Age(this DateTime date, DateTime asOf)
|
||||
{
|
||||
return (int)(((asOf.Date - TimeSpan.FromDays(1) - date.Date).TotalDays + 1) / 365.2425);
|
||||
@ -31,9 +32,9 @@
|
||||
/// <summary>
|
||||
/// Gets a DateTime representing the first occurence of a specified day in the current month.
|
||||
/// </summary>
|
||||
/// <param name="current">The current day</param>
|
||||
/// <param name="dayOfWeek">The current day of week</param>
|
||||
/// <returns>Returns a date which representing the first occurence of <paramref name="dayOfWeek"/>.</returns>
|
||||
/// <param name="current">The current day.</param>
|
||||
/// <param name="dayOfWeek">The current day of week.</param>
|
||||
/// <returns>Returns a date representing the first occurence of <paramref name="dayOfWeek"/>.</returns>
|
||||
public static DateTime First(this DateTime current, DayOfWeek dayOfWeek)
|
||||
{
|
||||
DateTime first = current.FirstDayOfMonth();
|
||||
@ -50,6 +51,7 @@
|
||||
/// Gets a <see cref="DateTime"/> representing the first day in the current month.
|
||||
/// </summary>
|
||||
/// <param name="current">The current date.</param>
|
||||
/// <returns>Returns a date representing the first day of the month>.</returns>
|
||||
public static DateTime FirstDayOfMonth(this DateTime current)
|
||||
{
|
||||
return current.AddDays(1 - current.Day);
|
||||
@ -59,6 +61,7 @@
|
||||
/// Gets a <see cref="DateTime"/> representing the last day in the current month.
|
||||
/// </summary>
|
||||
/// <param name="current">The current date.</param>
|
||||
/// <returns>Returns a date representing the last day of the month>.</returns>
|
||||
public static DateTime LastDayOfMonth(this DateTime current)
|
||||
{
|
||||
var daysInMonth = DateTime.DaysInMonth(current.Year, current.Month);
|
||||
@ -70,6 +73,7 @@
|
||||
/// </summary>
|
||||
/// <param name="current">The current date.</param>
|
||||
/// <param name="dayOfWeek">The current day of week.</param>
|
||||
/// <returns>Returns a date representing the final occurence of <paramref name="dayOfWeek"/>.</returns>
|
||||
public static DateTime Last(this DateTime current, DayOfWeek dayOfWeek)
|
||||
{
|
||||
DateTime last = current.LastDayOfMonth();
|
||||
@ -87,6 +91,7 @@
|
||||
/// </summary>
|
||||
/// <param name="current">The current date.</param>
|
||||
/// <param name="dayOfWeek">The day of week for the next date to get.</param>
|
||||
/// <returns>Returns a date representing the next occurence of <paramref name="dayOfWeek"/>.</returns>
|
||||
public static DateTime Next(this DateTime current, DayOfWeek dayOfWeek)
|
||||
{
|
||||
var offsetDays = dayOfWeek - current.DayOfWeek;
|
||||
|
Loading…
Reference in New Issue
Block a user