mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-22 16:49:22 -05:00
fixed use_intl_number_format fraction digits option
This commit is contained in:
parent
3a75c73767
commit
07f592b222
2 changed files with 21 additions and 14 deletions
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixes 🍕
|
||||
|
||||
- Fixed `use_geolocation` SSR compile issue
|
||||
- Fixed `use_intl_number_format` maximum fraction digits option
|
||||
|
||||
### Changes 🔥
|
||||
|
||||
|
|
|
@ -659,10 +659,12 @@ pub struct UseIntlNumberFormatOptions {
|
|||
maximum_fraction_digits: Option<u8>,
|
||||
|
||||
/// The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
|
||||
minimum_significant_digits: u8,
|
||||
#[builder(into)]
|
||||
minimum_significant_digits: Option<u8>,
|
||||
|
||||
/// The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
|
||||
maximum_significant_digits: u8,
|
||||
#[builder(into)]
|
||||
maximum_significant_digits: Option<u8>,
|
||||
}
|
||||
|
||||
impl UseIntlNumberFormatOptions {
|
||||
|
@ -700,8 +702,8 @@ impl Default for UseIntlNumberFormatOptions {
|
|||
minimum_integer_digits: 1,
|
||||
minimum_fraction_digits: None,
|
||||
maximum_fraction_digits: None,
|
||||
minimum_significant_digits: 1,
|
||||
maximum_significant_digits: 21,
|
||||
minimum_significant_digits: None,
|
||||
maximum_significant_digits: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -785,16 +787,20 @@ impl From<UseIntlNumberFormatOptions> for js_sys::Object {
|
|||
);
|
||||
}
|
||||
|
||||
let _ = Reflect::set(
|
||||
&obj,
|
||||
&"minimumSignificantDigits".into(),
|
||||
&options.minimum_significant_digits.into(),
|
||||
);
|
||||
let _ = Reflect::set(
|
||||
&obj,
|
||||
&"maximumSignificantDigits".into(),
|
||||
&options.maximum_significant_digits.into(),
|
||||
);
|
||||
if let Some(minimum_significant_digits) = options.minimum_significant_digits {
|
||||
let _ = Reflect::set(
|
||||
&obj,
|
||||
&"minimumSignificantDigits".into(),
|
||||
&minimum_significant_digits.into(),
|
||||
);
|
||||
}
|
||||
if let Some(maximum_significant_digits) = options.maximum_significant_digits {
|
||||
let _ = Reflect::set(
|
||||
&obj,
|
||||
&"maximumSignificantDigits".into(),
|
||||
&maximum_significant_digits.into(),
|
||||
);
|
||||
}
|
||||
|
||||
obj
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue