-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug that caused the external game deploy screen to interpret se…
…ssion dates incorrectly.
- Loading branch information
1 parent
d9b58fb
commit 8053ad8
Showing
2 changed files
with
22 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
projects/gameboard-ui/src/app/services/api-date.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { DateTime } from 'luxon'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class ApiDateService { | ||
toDateTime(input?: string): DateTime | null { | ||
if (!input) return null; | ||
|
||
// as of now, the API returns date objects as string (blargh) | ||
const parsedDateTime = DateTime.fromISO(input); | ||
|
||
// also, it stores null dates as 1/1/01, so account for that too | ||
if (parsedDateTime.year == 1) | ||
return null; | ||
|
||
return parsedDateTime; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters