mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +08:00
Construct a birthday year if none provided and hide its display
This commit is contained in:
parent
0540b6571b
commit
27ae37620f
1 changed files with 5 additions and 1 deletions
|
@ -149,7 +149,11 @@ const ContactAttributes = ({
|
|||
<Icons.Crown />
|
||||
</label>
|
||||
<div>
|
||||
{new Date(item.date.year, item.date.month - 1, item.date.day).toLocaleDateString()}
|
||||
{ // If there is no year given, solely display the month and day
|
||||
item.date.year ?
|
||||
new Date(item.date.year, item.date.month - 1, item.date.day).toLocaleDateString() :
|
||||
new Date(new Date().getFullYear(), item.date.month - 1, item.date.day).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
|
Loading…
Reference in a new issue