Skip to content

Commit

Permalink
update LRE date
Browse files Browse the repository at this point in the history
  • Loading branch information
svehera committed Nov 11, 2024
1 parent b24a141 commit ac52e2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/assets/UnitData.json
Original file line number Diff line number Diff line change
Expand Up @@ -1993,8 +1993,8 @@
"id": 7,
"finished": false,
"eventStage": 2,
"nextEventDate": "TBA",
"nextEventDateUtc": ""
"nextEventDate": "December 8",
"nextEventDateUtc": "Sun, 8 December 2024 00:00:00 GMT"
}
},
{
Expand Down Expand Up @@ -2140,9 +2140,9 @@
"lre": {
"id": 9,
"finished": false,
"eventStage": 1,
"nextEventDate": "November 3",
"nextEventDateUtc": "Sun, 3 November 2024 00:00:00 GMT"
"eventStage": 2,
"nextEventDate": "TBA",
"nextEventDateUtc": ""
}
}
]
12 changes: 7 additions & 5 deletions src/services/static-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class StaticDataService {
static readonly activeLres = this.lreCharacters.filter(x => !x.lre?.finished);
static readonly inactiveLres = this.lreCharacters.filter(x => !!x.lre?.finished);

static readonly activeLre = (() => {
static readonly activeLre: IUnitData = (() => {
const now = new Date();
const eightDays = 8;
const currentLreDate = new Date(this.lreCharacters[0]!.lre!.nextEventDateUtc!);
Expand All @@ -65,10 +65,12 @@ export class StaticDataService {
if (now < currentLreDate) {
return this.lreCharacters[0];
} else {
return this.lreCharacters.find(x => {
const eventDate = new Date(x.lre?.nextEventDateUtc ?? '');
return eventDate > now;
})!;
return (
this.lreCharacters.find(x => {
const eventDate = new Date(x.lre?.nextEventDateUtc ?? '');
return eventDate > now;
}) ?? this.lreCharacters[0]
);
}
})();

Expand Down

0 comments on commit ac52e2a

Please sign in to comment.