Skip to content

Commit 2e8d537

Browse files
committed
Mention the rounding mode in secondFraction docs
1 parent a96c194 commit 2e8d537

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/common/src/format/DateTimeFormatBuilder.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ public sealed interface DateTimeFormatBuilder {
154154
*
155155
* When formatting, the decimal fraction will be rounded to fit in the specified [maxLength] and will add
156156
* trailing zeroes to the specified [minLength].
157+
* Rounding is performed using the round-half-up rounding mode. If rounding the fraction would result in a carry
158+
* to the whole part, the whole part stays the same, and the fraction is formatted as repeated nines, so
159+
* rounding `15.9996` to milliseconds outputs `15.999`.
157160
*
158161
* When parsing, the parser will require that the fraction is at least [minLength] and at most [maxLength]
159162
* digits long.
@@ -172,6 +175,9 @@ public sealed interface DateTimeFormatBuilder {
172175
*
173176
* When formatting, the decimal fraction will add trailing zeroes or be rounded as necessary to always output
174177
* exactly the number of digits specified in [fixedLength].
178+
* Rounding is performed using the round-half-up rounding mode. If rounding the fraction would result in a carry
179+
* to the whole part, the whole part stays the same, and the fraction is formatted as repeated nines, so
180+
* rounding `15.9996` to milliseconds outputs `15.999`.
175181
*
176182
* When parsing, exactly [fixedLength] digits will be consumed.
177183
*

0 commit comments

Comments
 (0)