This commit is contained in:
seb
2026-07-31 07:00:04 +02:00
parent 724f873bfe
commit 9dac151854
11 changed files with 715 additions and 61 deletions

18
src/utils/companyForm.js Normal file
View File

@@ -0,0 +1,18 @@
export const ISO639_OPTIONS = ['de', 'en'];
export function defaultIso639() {
return navigator.language?.toLowerCase().startsWith('de') ? 'de' : 'en';
}
export function parseTaxRate(value) {
if (value === '' || value == null) return null;
const parsed = Number(value);
return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
}
/** Until backend returns iso639 on company objects. */
export function companyLanguageToIso639(company) {
if (company?.iso639) return company.iso639;
if (company?.languageId === 2) return 'en';
return 'de';
}