UI: Better default transit auto-rotation (#15474)

* TTL Picker convers to largest unit when value is number

* Initial value for transit auto-rotation period is 30d

* Add auto-rotation check to transit test

* Add changelog

* Add clarifying comment
This commit is contained in:
Chelsea Shaw
2022-05-17 16:06:57 -05:00
committed by GitHub
parent 6043e4d912
commit 7e0eab6483
6 changed files with 38 additions and 4 deletions

View File

@@ -74,7 +74,15 @@ export default TtlForm.extend({
if (typeOf(value) === 'number') {
// if the passed value is a number, assume unit is seconds
time = value;
// then check if the value can be converted into a larger unit
if (value % secondsMap.d === 0) {
unit = 'd';
} else if (value % secondsMap.h === 0) {
unit = 'h';
} else if (value % secondsMap.m === 0) {
unit = 'm';
}
time = convertFromSeconds(value, unit);
} else {
try {
const seconds = Duration.parse(value).seconds();