Skip to content

maximum_fraction_digits doesn't do anything #368

Open
@nazar-pc

Description

@nazar-pc

Setting this doesn't seem to have any effect whatsoever. I see it is set in the example here, but the input value doesn't have enough floating point digits to actually check it or else assertion would fail:

let num = FluentNumber::new(
25.2,
FluentNumberOptions {
maximum_fraction_digits: Some(8),
minimum_fraction_digits: Some(1),
..Default::default()
},
);
args.set("num", num);
let value = bundle.format_pattern(pattern, Some(&args), &mut errors);
// Notice, that since we specified minimum and maximum fraction digits options
// to be 1 and 8 when construction the argument, and then the minimum fraction
// digits option has been overridden in the localization the formatter
// will received options:
// - minimum_fraction_digits: Some(5)
// - maximum_fraction_digits: Some(8)
assert_eq!(
value,
"Here is an explicitly encoded variable: CUSTOM(25.2)."
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions