Skip to content

Commit

Permalink
🐛 zeropadding postal codes workarround
Browse files Browse the repository at this point in the history
workarround for jsyaml bug on numeric strings with leading zeroes

See nodeca/js-yaml#684
  • Loading branch information
vokimon committed Mar 12, 2024
1 parent 6c1ec32 commit 3561d9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tomatic/ui/src/pages/CallinfoPage/PartnerInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ function nameFromFullName(name) {
return parts[1]
}

function zeropad(value, num) {
if (!value) return value
return(value+"").padStart(num, '0')
}

function IconLabel({icon, label}) {
return <i className={icon.split('.').join(' ')} aria-label={label} />
}
Expand Down Expand Up @@ -74,7 +79,7 @@ function PartnerContent() {
<IconLabel icon="fa.fa-city" label="Municipi i Província" />{' '}
{markedErrorIfMissing(partner.city, 'Sense municipi')}
{' ('}
{markedErrorIfMissing(partner.postalcode, 'Sense codi postal')}
{markedErrorIfMissing(zeropad(partner.postalcode, 5), 'Sense codi postal')}
{') '}
{markedErrorIfMissing(partner.state, 'Sense província')}
</InfoLine>
Expand Down

0 comments on commit 3561d9b

Please sign in to comment.