Skip to content

Commit 87f2b99

Browse files
committed
feat(date-utils): default rounding logic to nearest
1 parent 7cf40d4 commit 87f2b99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DateUtils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export function dateByAddingSeconds(date, seconds) {
2121

2222
export function roundedMinute(date, rounding = Rounding.Nearest) {
2323
const seconds = date.getUTCSeconds();
24-
let offset = 0;
25-
if (rounding === Rounding.Nearest) {
26-
offset = seconds >= 30 ? 60 - seconds : -1 * seconds;
27-
} else if (rounding === Rounding.Up) {
24+
let offset = seconds >= 30 ? 60 - seconds : -1 * seconds;
25+
if (rounding === Rounding.Up) {
2826
offset = 60 - seconds;
27+
} else if (rounding === Rounding.None) {
28+
offset = 0;
2929
}
3030

3131
return dateByAddingSeconds(date, offset);

0 commit comments

Comments
 (0)