// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ namespace Microsoft.Graph { using System; using Newtonsoft.Json; /// /// Custom Date model for serialization /// [JsonConverter(typeof(DateConverter))] public class Date { /// /// Internal Date constructor /// /// internal Date(DateTime dateTime) { this.DateTime = dateTime; } /// /// Create a new Date object from a year, month, and day. /// /// The year. /// The month. /// The day of the month. public Date(int year, int month, int day) : this(new DateTime(year, month, day)) { } /// /// The DateTime object. /// internal DateTime DateTime { get; set; } /// /// The date's year. /// public int Year { get { return this.DateTime.Year; } } /// /// The date's month. /// public int Month { get { return this.DateTime.Month; } } /// /// The date's day. /// public int Day { get { return this.DateTime.Day; } } /// /// Convert the date to a string. /// /// The string value of the date in the format "yyyy-MM-dd". public override string ToString() { return this.DateTime.ToString("yyyy-MM-dd"); } } }