Skip to content

Commit

Permalink
fix(form): Correct number formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinci1it2000 committed Sep 26, 2024
1 parent 6455fba commit 786e4d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion schedula/utils/form/react/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
fetch(`${forms_url}/${name}-schema.json`).then(v => v.json()),
fetch(`${forms_url}/${name}-ui.json`).then(v => v.json())
]).then(([schema, uiSchema]) => {
schedula.renderForm({element, url, name, schema, uiSchema})
schedula.renderForm({
element,
url,
name,
schema,
uiSchema,
language: 'en_US'
})
});
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion schedula/utils/form/react/src/core/components/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function defineValidator(precompiledValidator, language, schema, nonce) {
optimize: false
}
}
}, local = localizer[language.split('_')[0]] || localizer.en
}, local = localizer[(language || '').split('_')[0]] || localizer.en
if (precompiledValidator) {
const code = compileSchemaValidatorsCode(schema, options);
return evaluateValidator(hash(schema), code, nonce).then((precompiledValidator) => createPrecompiledValidator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function InputNumberTemplate(
{format, value, id, emptyValue, onBlur, onFocus, ...props}) {
const [focused, setFocused] = useState(false)
const {getLocale} = useLocaleStore()
const locale = getLocale('locale')
const locale = getLocale('language').replace("_", "-")

const {key, numberParser, numberFormatter} = useMemo(() => {
const group = new Intl.NumberFormat(locale).format(1111).replace(/1/g, "");
Expand Down

0 comments on commit 786e4d9

Please sign in to comment.