Migrate to dayjs and Astro 4.0
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
import {groups, players} from "../../../stores/stores.js";
|
||||
import TypeAheadSearch from "../../components/TypeAheadSearch.svelte";
|
||||
import type {UpdateFight} from "../../../repo/fight.js";
|
||||
import moment from "moment";
|
||||
import * as dayjs from "dayjs";
|
||||
import * as duration from "dayjs/plugin/duration"
|
||||
dayjs.extend(duration)
|
||||
|
||||
export let data: ExtendedEvent;
|
||||
|
||||
@@ -133,11 +135,11 @@
|
||||
groupChangeOpen = false;
|
||||
}
|
||||
|
||||
$: minTime = moment(Math.min(...fights.map(fight => fight.start))).utc(true);
|
||||
$: minTime = dayjs(Math.min(...fights.map(fight => fight.start))).utc(true);
|
||||
let changeTimeOpen = false;
|
||||
let changedTime = moment(Math.min(...fights.map(fight => fight.start)))?.utc(true)?.toISOString()?.slice(0, -1);
|
||||
let changedTime = dayjs(Math.min(...fights.map(fight => fight.start)))?.utc(true)?.toISOString()?.slice(0, -1);
|
||||
|
||||
$: deltaTime = moment.duration(moment(changedTime).utc(true).diff(minTime))
|
||||
$: deltaTime = dayjs.duration(dayjs(changedTime).utc(true).diff(minTime))
|
||||
|
||||
async function updateStartTime() {
|
||||
for (const fight of selectedFights) {
|
||||
@@ -148,7 +150,7 @@
|
||||
map: null,
|
||||
redTeam: null,
|
||||
spielmodus: null,
|
||||
start: moment(fight.start).add(deltaTime.asMilliseconds(), 'millisecond')
|
||||
start: dayjs(fight.start).add(deltaTime.asMilliseconds(), 'millisecond')
|
||||
};
|
||||
await $fightRepo.updateFight(fight.id, f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user