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 656a30a commit ed8177d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tomatic/ui/src/pages/CallinfoPage/PartnerInfo.js
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 ed8177d

Please sign in to comment.