Replace deprecated temporal proposal polyfill (#12636)
* Replace deprecated temporal proposal polyfill Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch polyfill Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Rounding Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
6b90fe20ab
commit
0434929ee5
3 changed files with 27 additions and 108 deletions
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React, { HTMLProps } from "react";
|
||||
import { Temporal } from "proposal-temporal";
|
||||
import { Temporal } from "temporal-polyfill";
|
||||
|
||||
import { formatSeconds } from "../../../DateUtils";
|
||||
|
||||
|
@ -45,8 +45,9 @@ export default class Clock extends React.Component<Props> {
|
|||
return currentFloor !== nextFloor;
|
||||
}
|
||||
|
||||
private calculateDuration(seconds: number): string {
|
||||
return new Temporal.Duration(0, 0, 0, 0, 0, 0, seconds)
|
||||
private calculateDuration(seconds: number): string | undefined {
|
||||
if (isNaN(seconds)) return undefined;
|
||||
return new Temporal.Duration(0, 0, 0, 0, 0, 0, Math.round(seconds))
|
||||
.round({ smallestUnit: "seconds", largestUnit: "hours" })
|
||||
.toString();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue