25 lines
No EOL
553 B
C#
25 lines
No EOL
553 B
C#
using System;
|
|
|
|
namespace Website.Extensions {
|
|
public static class DateTimeExtensions {
|
|
private static string GetDaySuffix(int day) {
|
|
switch (day) {
|
|
case 1:
|
|
case 21:
|
|
case 31:
|
|
return @"\s\t";
|
|
case 2:
|
|
case 22:
|
|
return @"\n\d";
|
|
case 3:
|
|
case 23:
|
|
return @"\r\d";
|
|
default:
|
|
return @"\t\h";
|
|
}
|
|
}
|
|
|
|
public static string GetDaySuffix(this DateTime dateTime) => GetDaySuffix(dateTime.Day);
|
|
public static string GetDaySuffix(this DateTimeOffset dateTimeOffset) => GetDaySuffix(dateTimeOffset.Day);
|
|
}
|
|
} |