empty strings or zero will be converted to null

This commit is contained in:
2024-09-11 11:49:47 +02:00
parent 83307684ee
commit fe759f953f
5 changed files with 19 additions and 17 deletions

View File

@@ -41,16 +41,18 @@ export class ValidatedLocationComponent extends BaseInputComponent {
}
onInputChange(event: Place): void {
this.value = event; //{ ...event, longitude: parseFloat(event.longitude), latitude: parseFloat(event.latitude) };
this.value = {
id: event?.place_id,
name: event?.address.city,
county: event?.address.county,
street: event?.address.road,
housenumber: event?.address.house_number,
state: event?.address['ISO3166-2-lvl4'].substr(3),
latitude: event ? parseFloat(event?.lat) : undefined,
longitude: event ? parseFloat(event?.lon) : undefined,
};
if (event) {
this.value = {
id: event?.place_id,
name: event?.address.city,
county: event?.address.county,
street: event?.address.road,
housenumber: event?.address.house_number,
state: event?.address['ISO3166-2-lvl4'].substr(3),
latitude: event ? parseFloat(event?.lat) : undefined,
longitude: event ? parseFloat(event?.lon) : undefined,
};
}
this.onChange(this.value);
}
private loadCities() {