Skip to content

Commit

Permalink
fix: dont show current time when time missing
Browse files Browse the repository at this point in the history
  • Loading branch information
JLaferri committed Jul 4, 2023
1 parent 6208303 commit 17cdb50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/replays/loadFile.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { exists } from "@common/exists";
import type { GameStartType, MetadataType } from "@slippi/slippi-js";
import { SlippiGame } from "@slippi/slippi-js";
import * as fs from "fs-extra";
Expand Down Expand Up @@ -48,6 +49,10 @@ export async function loadFile(fullPath: string): Promise<FileResult> {
}

function convertToDateAndTime(dateTimeString: moment.MomentInput): moment.Moment | null {
if (!exists(dateTimeString)) {
return null;
}

const asMoment = moment(dateTimeString);
if (asMoment.isValid()) {
return asMoment.local();
Expand Down

0 comments on commit 17cdb50

Please sign in to comment.