From 1431c7f9232dcd1ba7d6d0120627c230cc549e4b Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 20 May 2023 10:35:12 +0200 Subject: [PATCH] Change uptime to last 90 days --- apps/api/src/app/info/info.service.ts | 8 ++++++-- apps/client/src/app/pages/open/open-page.html | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index 4da329667..d898e34d7 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -17,6 +17,7 @@ import { ghostfolioFearAndGreedIndexDataSource } from '@ghostfolio/common/config'; import { + DATE_FORMAT, encodeDataSource, extractNumberFromString } from '@ghostfolio/common/helper'; @@ -29,7 +30,7 @@ import { Injectable, Logger } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import * as bent from 'bent'; import * as cheerio from 'cheerio'; -import { subDays } from 'date-fns'; +import { format, subDays } from 'date-fns'; @Injectable() export class InfoService { @@ -344,7 +345,10 @@ export class InfoService { )) as string; const get = bent( - `https://betteruptime.com/api/v2/monitors/${monitorId}/sla`, + `https://betteruptime.com/api/v2/monitors/${monitorId}/sla?from=${format( + subDays(new Date(), 90), + DATE_FORMAT + )}&to${format(new Date(), DATE_FORMAT)}`, 'GET', 'json', 200, diff --git a/apps/client/src/app/pages/open/open-page.html b/apps/client/src/app/pages/open/open-page.html index 2de588429..f75df1e77 100644 --- a/apps/client/src/app/pages/open/open-page.html +++ b/apps/client/src/app/pages/open/open-page.html @@ -96,6 +96,7 @@