mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 13:46:16 -08:00
fix(dashboard): address PR review feedback
This commit is contained in:
1 parent
7083bd2af4
commit
2ecb5c28f4
30 files changed
+340
-104
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { isSelectedEpgDayToday } from './multi-epg-container.component';
|
||||
|
||||
describe('isSelectedEpgDayToday', () => {
|
||||
it('returns true only when the selected EPG day is the actual current day', () => {
|
||||
const now = new Date('2026-05-21T20:00:00.000Z');
|
||||
|
||||
expect(isSelectedEpgDayToday('20260521', now)).toBe(true);
|
||||
expect(isSelectedEpgDayToday('20260520', now)).toBe(false);
|
||||
expect(isSelectedEpgDayToday('20260522', now)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -54,6 +54,13 @@ interface ProgramSearchResult extends EpgProgram {
|
||||
display_name?: string | null;
|
||||
}
|
||||
|
||||
export function isSelectedEpgDayToday(
|
||||
selectedDay: string,
|
||||
now: Date = new Date()
|
||||
): boolean {
|
||||
return selectedDay === format(now, 'yyyyMMdd');
|
||||
}
|
||||
|
||||
@Component({
|
||||
imports: [
|
||||
DatePipe,
|
||||
@@ -250,6 +257,9 @@ export class MultiEpgContainerComponent
|
||||
*/
|
||||
isProgramAiringNow(program: EnrichedProgram): boolean {
|
||||
const nowX = this.currentTimeLine();
|
||||
if (!isSelectedEpgDayToday(this.today())) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
nowX >= program.startPosition &&
|
||||
nowX <= program.startPosition + program.width
|
||||
|
||||
Reference in new issue
Block a user