mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
fix: opening hours pipe refreshing too often
This commit is contained in:
@@ -115,7 +115,7 @@ export class StringSplitPipe implements PipeTransform {
|
||||
@Injectable()
|
||||
@Pipe({
|
||||
name: 'openingHours',
|
||||
pure: false,
|
||||
pure: true,
|
||||
})
|
||||
export class OpeningHoursPipe implements PipeTransform, OnDestroy {
|
||||
locale: string;
|
||||
|
||||
@@ -55,7 +55,13 @@ export class OpeningHoursComponent implements OnDestroy, OnInit {
|
||||
|
||||
const millisecondsRemaining =
|
||||
// eslint-disable-next-line unicorn/prefer-date-now
|
||||
(ohObject.getNextChange()?.getTime() ?? 0) - new Date().getTime();
|
||||
(ohObject.getNextChange()?.getTime() ?? 0) - new Date().getTime() + 1000;
|
||||
|
||||
if (millisecondsRemaining > 1_209_600_000) {
|
||||
// setTimeout has upper bound of 0x7FFFFFFF
|
||||
// ignore everything over a week
|
||||
return;
|
||||
}
|
||||
|
||||
if (millisecondsRemaining > 0) {
|
||||
this.timer = setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user