fix air alert time
This commit is contained in:
parent
3b8d8f15b0
commit
43c22e6492
1 changed files with 16 additions and 2 deletions
|
@ -1,10 +1,24 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { MetagameWorld } from "~/utils/metagame";
|
import type { MetagameWorld } from "~/utils/metagame";
|
||||||
import { humanTimeAgo } from "~/utils/strings";
|
import { humanTimeAgo } from "~/utils/strings";
|
||||||
import * as styles from "./alert-timer.css";
|
import * as styles from "./alert-timer.css";
|
||||||
|
|
||||||
const endTime = (alert: Required<MetagameWorld["zones"][0]>["alert"]) => {
|
const endTime = (alert: Required<MetagameWorld["zones"][0]>["alert"]) => {
|
||||||
const alertDurationMins = alert.alert_type !== "sudden_death" ? 90 : 15;
|
let alertDurationMins = 90;
|
||||||
|
|
||||||
|
switch (alert.alert_type) {
|
||||||
|
case "air":
|
||||||
|
alertDurationMins = 30;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "sudden_death":
|
||||||
|
alertDurationMins = 15;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return new Date(alert.start_time).getTime() + alertDurationMins * 60 * 1000;
|
return new Date(alert.start_time).getTime() + alertDurationMins * 60 * 1000;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue