fix leap year birthdays

This commit is contained in:
Spectralitree 2021-02-06 17:02:44 +01:00
parent 586782ae67
commit 5557251934
2 changed files with 4 additions and 6 deletions

View File

@ -38,8 +38,7 @@ export default function MemberCard(props) {
if (member.birthday) { if (member.birthday) {
if (member.birthday.startsWith('0004-')) { if (member.birthday.startsWith('0004-')) {
var bday = member.birthday.replace('0004-',''); var bdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D');
var bdaymoment = moment(bday, 'MM-DD').format('MMM D');
setBirthday(bdaymoment); setBirthday(bdaymoment);
} else { } else {
var birthdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D, YYYY'); var birthdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D, YYYY');
@ -93,7 +92,7 @@ export default function MemberCard(props) {
{ member.avatar_url ? <Popup trigger={<BS.Image src={`${member.avatar_url}`} style={{width: 50, height: 50}} tabIndex="0" className="float-right" roundedCircle />} className="avatar" modal> { member.avatar_url ? <Popup trigger={<BS.Image src={`${member.avatar_url}`} style={{width: 50, height: 50}} tabIndex="0" className="float-right" roundedCircle />} className="avatar" modal>
{close => ( {close => (
<div className="text-center w-100 m-0" onClick={() => close()}> <div className="text-center w-100 m-0" onClick={() => close()}>
<BS.Image src={`${avatar}`} style={{'max-width': 640, height: 'auto'}} thumbnail /> <BS.Image src={`${avatar}`} style={{'maxWidth': '100%', height: 'auto'}} thumbnail />
</div> </div>
)} )}
</Popup> : </Popup> :

View File

@ -38,8 +38,7 @@ export default function ProfilePage(props) {
if (member.birthday) { if (member.birthday) {
if (member.birthday.startsWith('0004-')) { if (member.birthday.startsWith('0004-')) {
var bday = member.birthday.replace('0004-',''); var bdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D');
var bdaymoment = moment(bday, 'MM-DD').format('MMM D');
setBirthday(bdaymoment); setBirthday(bdaymoment);
} else { } else {
var birthdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D, YYYY'); var birthdaymoment = moment(member.birthday, 'YYYY-MM-DD').format('MMM D, YYYY');
@ -95,7 +94,7 @@ export default function ProfilePage(props) {
{ member.avatar_url ? <Popup trigger={<BS.Image src={`${member.avatar_url}`} style={{width: 50, height: 50}} tabIndex="0" className="float-right" roundedCircle />} className="avatar" modal> { member.avatar_url ? <Popup trigger={<BS.Image src={`${member.avatar_url}`} style={{width: 50, height: 50}} tabIndex="0" className="float-right" roundedCircle />} className="avatar" modal>
{close => ( {close => (
<div className="text-center w-100 m-0" onClick={() => close()}> <div className="text-center w-100 m-0" onClick={() => close()}>
<BS.Image src={`${avatar}`} style={{'max-width': 640, height: 'auto'}} thumbnail /> <BS.Image src={`${avatar}`} style={{'maxWidth': '100%', height: 'auto'}} thumbnail />
</div> </div>
)} )}
</Popup> : </Popup> :