Skip to content

Commit

Permalink
Merge pull request #56 from 0xced/ObsoleteDateTimeExtensions
Browse files Browse the repository at this point in the history
Mark DateTimeExtensions methods as obsolete
  • Loading branch information
damianh authored Nov 19, 2024
2 parents 777f4e8 + 7c46558 commit 5211621
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions identity-model/src/IdentityModel/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class DateTimeExtensions
/// <summary>
/// Converts the given date value to epoch time.
/// </summary>
[Obsolete("Please use DateTimeOffset.ToUnixTimeSeconds() instead.")]
public static long ToEpochTime(this DateTime dateTime)
{
var date = dateTime.ToUniversalTime();
Expand All @@ -22,6 +23,7 @@ public static long ToEpochTime(this DateTime dateTime)
/// <summary>
/// Converts the given epoch time to a <see cref="DateTime"/> with <see cref="DateTimeKind.Utc"/> kind.
/// </summary>
[Obsolete("Please use DateTimeOffset.FromUnixTimeSeconds() instead.")]
public static DateTime ToDateTimeFromEpoch(this long date)
{
var timeInTicks = date * TimeSpan.TicksPerSecond;
Expand Down

0 comments on commit 5211621

Please sign in to comment.