refactor: update match time utilities and improve local match window logic
- Introduced new functions `isInLocalTodayMatchWindow` and `isAfterLocalTodayMatchWindow` to enhance match time checks. - Replaced the deprecated `dayKeyInTimeZone` function with `isInLocalTodayMatchWindow` in the PlayerController. - Updated related tests and utility exports to reflect the new naming conventions. - Improved handling of local match windows in various components for better accuracy.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
formatLocalMatchDateTime,
|
||||
isAfterLocalToday,
|
||||
isInLocalToday,
|
||||
isAfterLocalTodayMatchWindow,
|
||||
isInLocalTodayMatchWindow,
|
||||
isoToPlatformPickerDateTime,
|
||||
platformPickerDateTimeToIso,
|
||||
} from '@thebet365/shared';
|
||||
@@ -32,10 +32,17 @@ describe('match time helpers', () => {
|
||||
expect(malaysia).not.toBe(newYork);
|
||||
});
|
||||
|
||||
it('uses the player local day for today and early buckets', () => {
|
||||
it('keeps early next-day matches in the player today bucket until local noon', () => {
|
||||
const now = new Date('2026-06-11T15:00:00-04:00');
|
||||
|
||||
expect(isInLocalToday('2026-06-12T02:00:00.000Z', now, 'America/New_York')).toBe(true);
|
||||
expect(isAfterLocalToday('2026-06-12T05:00:00.000Z', now, 'America/New_York')).toBe(true);
|
||||
expect(isInLocalTodayMatchWindow('2026-06-12T02:00:00.000Z', now, 'America/New_York')).toBe(
|
||||
true,
|
||||
);
|
||||
expect(isInLocalTodayMatchWindow('2026-06-12T15:59:59.000Z', now, 'America/New_York')).toBe(
|
||||
true,
|
||||
);
|
||||
expect(isAfterLocalTodayMatchWindow('2026-06-12T16:00:00.000Z', now, 'America/New_York')).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user