mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 06:17:55 +00:00
Change no-year sentinel value to 0004
This allows setting the date "Feb 29" with no year, since the year 0004 is a leap year in the Gregorian calendar, while the year 0001 isn't.
This commit is contained in:
parent
9394b14a38
commit
30ed293dc6
3 changed files with 10 additions and 5 deletions
|
|
@ -128,7 +128,8 @@ namespace PluralKit
|
|||
|
||||
public PrivacyLevel MemberPrivacy { get; set; }
|
||||
|
||||
/// Returns a formatted string representing the member's birthday, taking into account that a year of "0001" is hidden
|
||||
/// Returns a formatted string representing the member's birthday, taking into account that a year of "0001" or "0004" is hidden
|
||||
/// Before Feb 10 2020, the sentinel year was 0001, now it is 0004.
|
||||
[JsonIgnore] public string BirthdayString
|
||||
{
|
||||
get
|
||||
|
|
@ -136,7 +137,7 @@ namespace PluralKit
|
|||
if (Birthday == null) return null;
|
||||
|
||||
var format = LocalDatePattern.CreateWithInvariantCulture("MMM dd, yyyy");
|
||||
if (Birthday?.Year == 1) format = LocalDatePattern.CreateWithInvariantCulture("MMM dd");
|
||||
if (Birthday?.Year == 1 || Birthday?.Year == 4) format = LocalDatePattern.CreateWithInvariantCulture("MMM dd");
|
||||
return format.Format(Birthday.Value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue