/// <summary> /// Initializes a new instance from the specified <paramref name="timestamp"/>. /// </summary> /// <param name="timestamp">The timestamp.</param> public EssentialsWeek(EssentialsTime timestamp) { Week = TimeUtils.GetIso8601WeekNumber(timestamp.DateTimeOffset); Start = TimeUtils.GetStartOfWeek(timestamp.DateTimeOffset, timestamp.TimeZone); End = TimeUtils.GetEndOfWeek(timestamp.DateTimeOffset, timestamp.TimeZone); Year = GetYear(); }
/// <summary> /// Initializes a new instance from the specified <paramref name="timestamp"/>. /// </summary> /// <param name="timestamp">The timestamp.</param> public EssentialsWeek(DateTimeOffset timestamp) { Week = TimeUtils.GetIso8601WeekNumber(timestamp); Start = TimeUtils.GetStartOfWeek(timestamp); End = TimeUtils.GetEndOfWeek(timestamp); Year = GetYear(); }
/// <summary> /// Gets the week number of <paramref name="date"/> according to the <strong>ISO 8601</strong> specification. /// </summary> /// <param name="date">The date.</param> /// <returns>The <strong>ISO 8601</strong> week number.</returns> /// <see> /// <cref>https://en.wikipedia.org/wiki/ISO_8601</cref> /// </see> public static int GetIso8601WeekNumber(DateTimeOffset date) { return(TimeUtils.GetIso8601WeekNumber(date)); }