21 instantiations of DateOnly
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
Binding\FormDataMapperTests.cs (2)
2124{ "04/20/2023", typeof(DateOnly?), new DateOnly?(new DateOnly(2023, 04, 20))}, 2209{ "04/20/2023", typeof(DateOnly), new DateOnly(2023, 04, 20) },
FormMapping\Converters\NullableConverterTests.cs (2)
30var date = new DateOnly(2023, 11, 30); 106var date = new DateOnly(2023, 11, 30);
Microsoft.AspNetCore.Components.Tests (2)
PersistentStateValueProviderKeyResolverTests.cs (2)
38{ new DateOnly(2023, 1, 1), new DateOnly(2023, 12, 31) },
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (1)
46new object[] { "DateOnly", "9/20/2021 ", new DateOnly(2021, 9, 20) },
Microsoft.AspNetCore.Mvc.TagHelpers.Test (2)
InputTagHelperTest.cs (2)
2150var model = new DateOnly( 2285var model = new DateOnly(
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
95yield return new TestData<DateOnly>(new(2021, 1, 1), """{"type":"string","format": "date"}""");
Microsoft.Gen.Logging.Generated.Tests (1)
LogPropertiesTests.cs (1)
112P20 = new DateOnly(2022, 6, 21),
System.Private.CoreLib (10)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (10)
45public static DateOnly MinValue => new DateOnly(MinDayNumber); 50public static DateOnly MaxValue => new DateOnly(MaxDayNumber); 80return new DateOnly((uint)dayNumber); 129return new DateOnly(newDayNumber); 139public DateOnly AddMonths(int value) => new DateOnly(DayNumberFromDateTime(GetEquivalentDateTime().AddMonths(value))); 146public DateOnly AddYears(int value) => new DateOnly(DayNumberFromDateTime(GetEquivalentDateTime().AddYears(value))); 232public static DateOnly FromDateTime(DateTime dateTime) => new DateOnly(DayNumberFromDateTime(dateTime)); 461result = new DateOnly(DayNumberFromDateTime(dtResult.parsedDate)); 526result = new DateOnly(DayNumberFromDateTime(dtResult.parsedDate)); 594result = new DateOnly(DayNumberFromDateTime(dtResult.parsedDate));
287 references to DateOnly
Aspire.Hosting.Testing.Tests (2)
TestingBuilderTests.cs (1)
558private sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
TestingFactoryTests.cs (1)
88private sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Aspire.Templates.Tests (1)
StarterTemplateRunTestsBase.cs (1)
178public sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
BlazorUnitedApp (2)
Data\WeatherForecast.cs (1)
8public DateOnly Date { get; set; }
Data\WeatherForecastService.cs (1)
13public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
Deployers.ApiService (2)
Program.cs (2)
17DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 27sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Keycloak.ApiService (2)
Program.cs (2)
33DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 46sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Keycloak.Web (1)
WeatherApiClient.cs (1)
26public record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Microsoft.AspNetCore.Components (74)
BindConverter.cs (36)
499public static string FormatValue(DateOnly value, CultureInfo? culture = null) => FormatDateOnlyValueCore(value, format: null, culture); 505/// <param name="format">The format to use. Provided to <see cref="DateOnly.ToString(string, IFormatProvider)"/>.</param> 511public static string FormatValue(DateOnly value, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, CultureInfo? culture = null) => FormatDateOnlyValueCore(value, format, culture); 513private static string FormatDateOnlyValueCore(DateOnly value, string? format, CultureInfo? culture) 524private static string FormatDateOnlyValueCore(DateOnly value, CultureInfo? culture) 538public static string? FormatValue(DateOnly? value, CultureInfo? culture = null) => FormatNullableDateOnlyValueCore(value, format: null, culture); 544/// <param name="format">The format to use. Provided to <see cref="DateOnly.ToString(string, IFormatProvider)"/>.</param> 550public static string? FormatValue(DateOnly? value, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, CultureInfo? culture = null) => FormatNullableDateOnlyValueCore(value, format, culture); 552private static string? FormatNullableDateOnlyValueCore(DateOnly? value, string? format, CultureInfo? culture) 568private static string? FormatNullableDateOnlyValueCore(DateOnly? value, CultureInfo? culture) 593/// <param name="format">The format to use. Provided to <see cref="DateOnly.ToString(string, IFormatProvider)"/>.</param> 632/// <param name="format">The format to use. Provided to <see cref="DateOnly.ToString(string, IFormatProvider)"/>.</param> 1394/// Attempts to convert a value to a <see cref="System.DateOnly"/>. 1400public static bool TryConvertToDateOnly(object? obj, CultureInfo? culture, out DateOnly value) 1406/// Attempts to convert a value to a <see cref="System.DateOnly"/>. 1413public static bool TryConvertToDateOnly(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, out DateOnly value) 1419/// Attempts to convert a value to a nullable <see cref="System.DateOnly"/>. 1425public static bool TryConvertToNullableDateOnly(object? obj, CultureInfo? culture, out DateOnly? value) 1431/// Attempts to convert a value to a nullable <see cref="System.DateOnly"/>. 1438public static bool TryConvertToNullableDateOnly(object? obj, CultureInfo? culture, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, out DateOnly? value) 1443internal static BindParser<DateOnly> ConvertToDateOnly = ConvertToDateOnlyCore; 1444internal static BindParserWithFormat<DateOnly> ConvertToDateOnlyWithFormat = ConvertToDateOnlyCore; 1445internal static BindParser<DateOnly?> ConvertToNullableDateOnly = ConvertToNullableDateOnlyCore; 1446internal static BindParserWithFormat<DateOnly?> ConvertToNullableDateOnlyWithFormat = ConvertToNullableDateOnlyCore; 1448private static bool ConvertToDateOnlyCore(object? obj, CultureInfo? culture, out DateOnly value) 1453private static bool ConvertToDateOnlyCore(object? obj, CultureInfo? culture, string? format, out DateOnly value) 1458value = DateOnly.FromDateTime(dateTime); 1466private static bool ConvertToNullableDateOnlyCore(object? obj, CultureInfo? culture, out DateOnly? value) 1471private static bool ConvertToNullableDateOnlyCore(object? obj, CultureInfo? culture, string? format, out DateOnly? value) 1476value = DateOnly.FromDateTime(dateTime); 1775else if (typeof(T) == typeof(DateOnly)) 1777formatter = (BindFormatter<DateOnly>)FormatDateOnlyValueCore; 1779else if (typeof(T) == typeof(DateOnly?)) 1781formatter = (BindFormatter<DateOnly?>)FormatNullableDateOnlyValueCore; 1974else if (typeof(T) == typeof(DateOnly)) 1978else if (typeof(T) == typeof(DateOnly?))
ChangeDetection.cs (1)
57|| type == typeof(DateOnly)
EventCallbackFactoryBinderExtensions.cs (24)
974Action<DateOnly> setter, 975DateOnly existingValue, 978return CreateBinderCore<DateOnly>(factory, receiver, setter, culture, ConvertToDateOnly); 994Func<DateOnly, Task> setter, 995DateOnly existingValue, 998return CreateBinderCoreAsync<DateOnly>(factory, receiver, setter, culture, ConvertToDateOnly); 1015Action<DateOnly> setter, 1016DateOnly existingValue, 1020return CreateBinderCore<DateOnly>(factory, receiver, setter, culture, format, ConvertToDateOnlyWithFormat); 1037Func<DateOnly, Task> setter, 1038DateOnly existingValue, 1042return CreateBinderCoreAsync<DateOnly>(factory, receiver, setter, culture, format, ConvertToDateOnlyWithFormat); 1058Action<DateOnly?> setter, 1059DateOnly? existingValue, 1062return CreateBinderCore<DateOnly?>(factory, receiver, setter, culture, ConvertToNullableDateOnly); 1078Func<DateOnly?, Task> setter, 1079DateOnly? existingValue, 1082return CreateBinderCoreAsync<DateOnly?>(factory, receiver, setter, culture, ConvertToNullableDateOnly); 1099Action<DateOnly?> setter, 1100DateOnly? existingValue, 1104return CreateBinderCore<DateOnly?>(factory, receiver, setter, culture, format, ConvertToNullableDateOnlyWithFormat); 1121Func<DateOnly?, Task> setter, 1122DateOnly? existingValue, 1126return CreateBinderCoreAsync<DateOnly?>(factory, receiver, setter, culture, format, ConvertToNullableDateOnlyWithFormat);
NavigationManagerExtensions.cs (6)
31[typeof(DateOnly)] = value => Format((DateOnly)value), 56private static string Format(DateOnly value) 59private static string? Format(DateOnly? value) 326public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateOnly value) 340public static string GetUriWithQueryParameter(this NavigationManager navigationManager, string name, DateOnly? value)
PersistentState\PersistentStateValueProviderKeyResolver.cs (1)
209|| keyType == typeof(DateOnly)
Routing\UrlValueConstraint.cs (6)
44private static bool TryParse(ReadOnlySpan<char> str, out DateOnly result) 45=> DateOnly.TryParse(str, CultureInfo.InvariantCulture, DateTimeStyles.None, out result); 72var x when x == typeof(DateOnly) => new TypedUrlValueConstraint<DateOnly>(TryParse), 73var x when x == typeof(DateOnly?) => new NullableTypedUrlValueConstraint<DateOnly>(TryParse),
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
66return type == typeof(DateOnly) || type == typeof(TimeOnly) || type == typeof(DateTimeOffset);
FormMapping\WellKnownConverters.cs (6)
40{ typeof(DateOnly), new ParsableConverter<DateOnly>() }, 72converters.Add(typeof(DateOnly?), new NullableConverter<DateOnly>((FormDataConverter<DateOnly>)converters[typeof(DateOnly)]));
Microsoft.AspNetCore.Components.Endpoints.Tests (24)
Binding\FormDataMapperTests.cs (4)
2124{ "04/20/2023", typeof(DateOnly?), new DateOnly?(new DateOnly(2023, 04, 20))}, 2166{ typeof(DateOnly?) }, 2209{ "04/20/2023", typeof(DateOnly), new DateOnly(2023, 04, 20) },
FormMapping\Converters\NullableConverterTests.cs (20)
18var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 30var date = new DateOnly(2023, 11, 30); 33var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 47var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 70var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 72var returnValue = nullableConverter.TryRead(ref reader, typeof(DateOnly?), default, out var result, out var found); 93var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 95var returnValue = nullableConverter.TryRead(ref reader, typeof(DateOnly?), default, out var result, out var found); 106var date = new DateOnly(2023, 11, 30); 117var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 119var returnValue = nullableConverter.TryRead(ref reader, typeof(DateOnly?), default, out var result, out var found); 143var nullableConverter = new NullableConverter<DateOnly>(new ParsableConverter<DateOnly>()); 145var returnValue = nullableConverter.TryRead(ref reader, typeof(DateOnly?), default, out var result, out var found);
Microsoft.AspNetCore.Components.Tests (6)
BindConverterTest.cs (4)
189var value = DateOnly.FromDateTime(DateTime.Now); 203var value = DateOnly.FromDateTime(DateTime.Now);
RenderTreeDiffBuilderTest.cs (2)
1739var dateOnlyWillNotChange = DateOnly.FromDateTime(dateTimeWillNotChange);
Microsoft.AspNetCore.Components.Web (3)
Forms\InputDate.cs (3)
17/// <item><description><see cref="DateOnly"/></description></item> 59type != typeof(DateOnly) && 104DateOnly dateOnlyValue => BindConverter.FormatValue(dateOnlyValue, _format, CultureInfo.InvariantCulture),
Microsoft.AspNetCore.Http.Extensions (11)
src\Components\Endpoints\src\FormMapping\Converters\NullableConverter.cs (1)
66return type == typeof(DateOnly) || type == typeof(TimeOnly) || type == typeof(DateTimeOffset);
src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
40{ typeof(DateOnly), new ParsableConverter<DateOnly>() }, 72converters.Add(typeof(DateOnly?), new NullableConverter<DateOnly>((FormDataConverter<DateOnly>)converters[typeof(DateOnly)]));
src\Shared\ParameterBindingMethodCache.cs (4)
550else if (type == typeof(DateOnly)) 552methodInfo = typeof(DateOnly).GetMethod( 553nameof(DateOnly.TryParse), 555new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateOnly).MakeByRefType() });
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ParameterBindingMethodCacheTests.cs (1)
63[InlineData(typeof(DateOnly))]
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (1)
162["DateOnly?", "default", default(DateOnly?), false],
Microsoft.AspNetCore.Mvc.Abstractions (4)
src\Shared\ParameterBindingMethodCache.cs (4)
550else if (type == typeof(DateOnly)) 552methodInfo = typeof(DateOnly).GetMethod( 553nameof(DateOnly.TryParse), 555new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateOnly).MakeByRefType() });
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointModelMetadata.cs (1)
63|| underlyingType == typeof(DateOnly)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (4)
EndpointMetadataApiDescriptionProviderTest.cs (4)
713AssertPathParameter(GetApiDescription((DateOnly foo) => { }, "/{foo}"), typeof(DateOnly)); 734AssertPathParameter(GetApiDescription((DateOnly? foo) => { }, "/{foo}"), typeof(DateOnly?));
Microsoft.AspNetCore.Mvc.TagHelpers (1)
InputTagHelper.cs (1)
492typeof(DateOnly) == modelExplorer.Metadata.UnderlyingOrModelType))
Microsoft.AspNetCore.Mvc.TagHelpers.Test (6)
InputTagHelperTest.cs (6)
2150var model = new DateOnly( 2285var model = new DateOnly( 2444public DateOnly DateOnlyDate { get; set; } 2446public DateOnly DateOnly { get; set; } 2456public DateOnly? NullableDateOnlyDate { get; set; } 2458public DateOnly? NullableDateOnly { get; set; }
Microsoft.AspNetCore.OpenApi (6)
Extensions\JsonNodeSchemaExtensions.cs (1)
48[typeof(DateOnly)] = new() { Type = JsonSchemaType.String, Format = "date" },
Services\OpenApiConstants.cs (1)
65typeof(DateOnly),
src\Shared\ParameterBindingMethodCache.cs (4)
550else if (type == typeof(DateOnly)) 552methodInfo = typeof(DateOnly).GetMethod( 553nameof(DateOnly.TryParse), 555new[] { typeof(string), typeof(IFormatProvider), typeof(DateTimeStyles), typeof(DateOnly).MakeByRefType() });
Microsoft.AspNetCore.OpenApi.Tests (4)
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.RequestBody.cs (1)
913[([FromForm] DateOnly id) => {}, JsonSchemaType.String, "date"]
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (2)
39[(DateOnly id) => {}, JsonSchemaType.String, "date"], 56[(DateOnly? id) => {}, JsonSchemaType.String, "date"]
Transformers\CustomSchemaTransformerTests.cs (1)
539public DateOnly DateOfBirth { get; set; }
Microsoft.Extensions.AI.Abstractions (1)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (1)
620[typeof(DateOnly)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "date" },
Microsoft.Extensions.AI.Abstractions.Tests (3)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
95yield return new TestData<DateOnly>(new(2021, 1, 1), """{"type":"string","format": "date"}"""); 1239[JsonSerializable(typeof(DateOnly))]
Utilities\AIJsonUtilitiesTests.cs (1)
963public DateOnly DateOnlyProp { get; set; }
Microsoft.Extensions.AI.Integration.Tests (1)
ChatClientIntegrationTests.cs (1)
463AIFunctionFactory.Create((DateOnly d) => d, createOptions()),
Microsoft.Extensions.Validation (1)
RuntimeValidatableParameterInfoResolver.cs (1)
94type == typeof(DateOnly) ||
Microsoft.Extensions.Validation.Tests (1)
RuntimeValidatableParameterInfoResolverTests.cs (1)
47[InlineData(typeof(DateOnly))]
Microsoft.Gen.Logging.Generated.Tests (1)
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesSpecialTypesExtensions.cs (1)
39public DateOnly P20 { get; set; }
PresentationCore.Tests (1)
System\Windows\DurationConverter.Tests.cs (1)
82[InlineData(typeof(DateOnly))]
Sample (1)
Endpoints\MapXmlEndpoints.cs (1)
40public DateOnly DateOnlyType { get; set; }
Stress.ApiService (2)
Program.cs (2)
318DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 377public record WeatherForecast(DateOnly Date, int TemperatureC, string Summary);
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
69typeof(T) == typeof(DateOnly) ||
System.ComponentModel.TypeConverter (13)
System\ComponentModel\DateOnlyConverter.cs (12)
11/// Provides a type converter to convert <see cref='System.DateOnly'/> objects to and from various other representations. 16/// Gets a value indicating whether this converter can convert an object in the given source type to a <see cref='System.DateOnly'/> 32/// Converts the given value object to a <see cref='System.DateOnly'/> object. 42return DateOnly.MinValue; 57return DateOnly.Parse(text, formatInfo); 61return DateOnly.Parse(text, culture); 66throw new FormatException(SR.Format(SR.ConvertInvalidPrimitive, (string)value, nameof(DateOnly)), e); 74/// Converts the given value object from a <see cref='System.DateOnly'/> object using the arguments. 79if (destinationType == typeof(string) && value is DateOnly dateOnly) 81if (dateOnly == DateOnly.MinValue) 96if (destinationType == typeof(InstanceDescriptor) && value is DateOnly date) 98return new InstanceDescriptor(typeof(DateOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int) }), new object[] { date.Year, date.Month, date.Day });
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
172[typeof(DateOnly)] = new IntrinsicTypeConverterData((type) => new DateOnlyConverter()),
System.Private.CoreLib (80)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (61)
18IComparable<DateOnly>, 19IEquatable<DateOnly>, 21ISpanParsable<DateOnly>, 45public static DateOnly MinValue => new DateOnly(MinDayNumber); 50public static DateOnly MaxValue => new DateOnly(MaxDayNumber); 73public static DateOnly FromDayNumber(int dayNumber) 121public DateOnly AddDays(int value) 139public DateOnly AddMonths(int value) => new DateOnly(DayNumberFromDateTime(GetEquivalentDateTime().AddMonths(value))); 146public DateOnly AddYears(int value) => new DateOnly(DayNumberFromDateTime(GetEquivalentDateTime().AddYears(value))); 154public static bool operator ==(DateOnly left, DateOnly right) => left._dayNumber == right._dayNumber; 162public static bool operator !=(DateOnly left, DateOnly right) => left._dayNumber != right._dayNumber; 170public static bool operator >(DateOnly left, DateOnly right) => left._dayNumber > right._dayNumber; 178public static bool operator >=(DateOnly left, DateOnly right) => left._dayNumber >= right._dayNumber; 186public static bool operator <(DateOnly left, DateOnly right) => left._dayNumber < right._dayNumber; 194public static bool operator <=(DateOnly left, DateOnly right) => left._dayNumber <= right._dayNumber; 197/// Deconstructs <see cref="DateOnly"/> by <see cref="Year"/>, <see cref="Month"/> and <see cref="Day"/>. 232public static DateOnly FromDateTime(DateTime dateTime) => new DateOnly(DayNumberFromDateTime(dateTime)); 239public int CompareTo(DateOnly value) => _dayNumber.CompareTo(value._dayNumber); 249if (value is not DateOnly dateOnly) 262public bool Equals(DateOnly value) => _dayNumber == value._dayNumber; 269public override bool Equals([NotNullWhen(true)] object? value) => value is DateOnly dateOnly && _dayNumber == dateOnly._dayNumber; 287public static DateOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None) 289ParseFailureKind result = TryParseInternal(s, provider, style, out DateOnly dateOnly); 310public static DateOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan<char> format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None) 312ParseFailureKind result = TryParseExactInternal(s, format, provider, style, out DateOnly dateOnly); 329public static DateOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats) => ParseExact(s, formats, null, DateTimeStyles.None); 340public static DateOnly ParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 342ParseFailureKind result = TryParseExactInternal(s, formats, provider, style, out DateOnly dateOnly); 356public static DateOnly Parse(string s) => Parse(s, null, DateTimeStyles.None); 365public static DateOnly Parse(string s, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 378public static DateOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format) => ParseExact(s, format, null, DateTimeStyles.None); 389public static DateOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 403public static DateOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats) => ParseExact(s, formats, null, DateTimeStyles.None); 414public static DateOnly ParseExact(string s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None) 426public static bool TryParse(ReadOnlySpan<char> s, out DateOnly result) => TryParse(s, null, DateTimeStyles.None, out result); 436public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) => TryParseInternal(s, provider, style, out result) == ParseFailureKind.None; 438private static ParseFailureKind TryParseInternal(ReadOnlySpan<char> s, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 473public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan<char> format, out DateOnly result) => TryParseExact(s, format, null, DateTimeStyles.None, out result); 485public static bool TryParseExact(ReadOnlySpan<char> s, [StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) => 487private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, ReadOnlySpan<char> format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 538public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string?[]? formats, out DateOnly result) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); 549public static bool TryParseExact(ReadOnlySpan<char> s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) => 552private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 609public static bool TryParse([NotNullWhen(true)] string? s, out DateOnly result) => TryParse(s, null, DateTimeStyles.None, out result); 619public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 638public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string? format, out DateOnly result) => TryParseExact(s, format, null, DateTimeStyles.None, out result); 650public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 668public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string?[]? formats, out DateOnly result) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); 679public static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateOnly result) 700throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, s.ToString(), nameof(DateOnly))); 822throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, format.ToString(), nameof(DateOnly))); 833public static DateOnly Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); 836public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); 843public static DateOnly Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); 846public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result);
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (9)
165/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/>. 174public DateTime(DateOnly date, TimeOnly time) 180/// Initializes a new instance of the <see cref="DateTime"/> structure to the specified <see cref="DateOnly"/> and <see cref="TimeOnly"/> respecting a <see cref="DateTimeKind"/>. 192public DateTime(DateOnly date, TimeOnly time, DateTimeKind kind) 1888/// Deconstructs <see cref="DateTime"/> into <see cref="DateOnly"/> and <see cref="TimeOnly"/>. 1891/// Deconstructed <see cref="DateOnly"/>. 1897public void Deconstruct(out DateOnly date, out TimeOnly time) 1899date = DateOnly.FromDateTime(this); 1904/// Deconstructs <see cref="DateOnly"/> by <see cref="Year"/>, <see cref="Month"/> and <see cref="Day"/>.
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (4)
134public DateTimeOffset(DateOnly date, TimeOnly time, TimeSpan offset) 1011/// Deconstructs <see cref="DateTimeOffset"/> into <see cref="DateOnly"/>, <see cref="TimeOnly"/> and <see cref="TimeSpan"/>. 1014/// Deconstructed <see cref="DateOnly"/>. 1023public void Deconstruct(out DateOnly date, out TimeOnly time, out TimeSpan offset)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (2)
1371internal static unsafe bool TryFormatDateOnlyO<TChar>(DateOnly value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 1398internal static unsafe bool TryFormatDateOnlyR<TChar>(DateOnly value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Globalization\ISOWeek.cs (4)
43public static int GetWeekOfYear(DateOnly date) => GetWeekOfYear(date.GetEquivalentDateTime()); 71public static int GetYear(DateOnly date) => GetYear(date.GetEquivalentDateTime()); 169public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) => DateOnly.FromDateTime(ToDateTime(year, week, dayOfWeek));
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
122[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.DateOnly))]
System.Text.Json (13)
System\Text\Json\JsonHelpers.Date.cs (2)
99public static bool TryParseAsIso(ReadOnlySpan<byte> source, out DateOnly value) 105value = DateOnly.FromDateTime(dateTime);
System\Text\Json\Nodes\JsonValueOfT.cs (1)
94type == typeof(DateOnly) || type == typeof(TimeOnly) ||
System\Text\Json\Serialization\Converters\Value\DateOnlyConverter.cs (7)
10internal sealed class DateOnlyConverter : JsonPrimitiveConverter<DateOnly> 15public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 25internal override DateOnly ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 31private static DateOnly ReadCore(ref Utf8JsonReader reader) 57if (!JsonHelpers.TryParseAsIso(source, out DateOnly value)) 65public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options) 73internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
55/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="DateOnly"/> values. 58public static JsonConverter<DateOnly> DateOnlyConverter => s_dateOnlyConverter ??= new DateOnlyConverter(); 59private static JsonConverter<DateOnly>? s_dateOnlyConverter;
TestingAppHost1.MyWebApp (2)
Program.cs (2)
28DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 54sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
Yarp.Backend (2)
Program.cs (2)
24DateOnly.FromDateTime(DateTime.Now.AddDays(index)), 35internal sealed record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)