Skip to content

Commit

Permalink
Merge pull request #207 from ilri/enhancements-Oct-2023
Browse files Browse the repository at this point in the history
Match countries using alpha 2, alpha 2, common name, official name, etc.
  • Loading branch information
alanorth authored Nov 21, 2023
2 parents bf027b1 + 3f788ce commit 9148cfb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/src/shared/services/formater.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ export class FormatService {
langISO.validate(value) ? langISO.getName(value) : value;

mapIsoToCountry(value: string) {
const country = CountryISO.get({ alpha_2: value }) as Country;
const country = CountryISO.get({
alpha_2: value,
alpha_3: value,
numeric: value,
name: value,
common_name: value,
official_name: value,
}) as Country;
return country ? country.name : this.capitalizeFirstLetter(value);
}

Expand Down

0 comments on commit 9148cfb

Please sign in to comment.