-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DateTimePolyfill and DateTimeOffsetPolyfill (#231)
- Loading branch information
1 parent
047eb30
commit d76228e
Showing
6 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
**API count: 352** | ||
**API count: 360** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
namespace Polyfills; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Globalization; | ||
using System.Text; | ||
using Link = System.ComponentModel.DescriptionAttribute; | ||
|
||
[ExcludeFromCodeCoverage] | ||
[DebuggerNonUserCode] | ||
#if PolyPublic | ||
public | ||
#endif | ||
static partial class DateTimeOffsetPolyfill | ||
{ | ||
/// <summary> | ||
/// Tries to parse a string into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tryparse#system-datetimeoffset-tryparse(system-string-system-iformatprovider-system-datetimeoffset@)")] | ||
public static bool TryParse(string? target, IFormatProvider? provider, out DateTimeOffset result) => | ||
#if NET7_0_OR_GREATER | ||
DateTimeOffset.TryParse(target, provider, out result); | ||
#else | ||
DateTimeOffset.TryParse(target, provider, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
#if FeatureMemory | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tryparse#system-datetimeoffset-tryparse(system-readonlyspan((system-char))-system-iformatprovider-system-datetimeoffset@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, IFormatProvider? provider, out DateTimeOffset result) => | ||
#if NET8_0_OR_GREATER | ||
DateTimeOffset.TryParse(target, provider, out result); | ||
#else | ||
DateTimeOffset.TryParse(target.ToString(), provider, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tryparse#system-datetimeoffset-tryparse(system-readonlyspan((system-char))-system-datetimeoffset@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, out DateTimeOffset result) => | ||
#if NETSTANDARD2_1 || NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER | ||
DateTimeOffset.TryParse(target, out result); | ||
#else | ||
DateTimeOffset.TryParse(target.ToString(), null, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tryparse#system-datetimeoffset-tryparse(system-readonlyspan((system-char))-system-iformatprovider-system-globalization-datetimestyles-system-datetimeoffset@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, IFormatProvider? provider, DateTimeStyles styles, out DateTimeOffset result) => | ||
#if NETSTANDARD2_1 || NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER | ||
DateTimeOffset.TryParse(target, provider, styles, out result); | ||
#else | ||
DateTimeOffset.TryParse(target.ToString(), provider, styles, out result); | ||
#endif | ||
|
||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
namespace Polyfills; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Globalization; | ||
using System.Text; | ||
using Link = System.ComponentModel.DescriptionAttribute; | ||
|
||
[ExcludeFromCodeCoverage] | ||
[DebuggerNonUserCode] | ||
#if PolyPublic | ||
public | ||
#endif | ||
static partial class DateTimePolyfill | ||
{ | ||
/// <summary> | ||
/// Tries to parse a string into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tryparse#system-datetime-tryparse(system-string-system-iformatprovider-system-datetime@)")] | ||
public static bool TryParse(string? target, IFormatProvider? provider, out DateTime result) => | ||
#if NET7_0_OR_GREATER | ||
DateTime.TryParse(target, provider, out result); | ||
#else | ||
DateTime.TryParse(target, provider, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
#if FeatureMemory | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tryparse#system-datetime-tryparse(system-readonlyspan((system-char))-system-iformatprovider-system-datetime@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, IFormatProvider? provider, out DateTime result) => | ||
#if NET8_0_OR_GREATER | ||
DateTime.TryParse(target, provider, out result); | ||
#else | ||
DateTime.TryParse(target.ToString(), provider, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tryparse#system-datetime-tryparse(system-readonlyspan((system-char))-system-datetime@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, out DateTime result) => | ||
#if NETSTANDARD2_1 || NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER | ||
DateTime.TryParse(target, out result); | ||
#else | ||
DateTime.TryParse(target.ToString(), null, DateTimeStyles.None, out result); | ||
#endif | ||
|
||
/// <summary> | ||
/// Tries to parse a span of characters into a value. | ||
/// </summary> | ||
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tryparse#system-datetime-tryparse(system-readonlyspan((system-char))-system-iformatprovider-system-globalization-datetimestyles-system-datetime@)")] | ||
public static bool TryParse(ReadOnlySpan<char> target, IFormatProvider? provider, DateTimeStyles styles, out DateTime result) => | ||
#if NETSTANDARD2_1 || NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER | ||
DateTime.TryParse(target, provider, styles, out result); | ||
#else | ||
DateTime.TryParse(target.ToString(), provider, styles, out result); | ||
#endif | ||
|
||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters