File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1319,6 +1319,30 @@ describe('calculateStreak — timezone awareness', () => {
13191319 const result = calculateStreak ( tzCalendar , 'UTC' , nowUTC ) ;
13201320 expect ( result . todayDate ) . toBe ( '2024-06-16' ) ;
13211321 } ) ;
1322+
1323+ it ( 'handles timezone boundary alignment between UTC, IST and JST' , ( ) => {
1324+ const calendar = {
1325+ totalContributions : 2 ,
1326+ weeks : [
1327+ {
1328+ contributionDays : [
1329+ { contributionCount : 1 , date : '2024-06-14' } ,
1330+ { contributionCount : 1 , date : '2024-06-15' } ,
1331+ ] ,
1332+ } ,
1333+ ] ,
1334+ } ;
1335+
1336+ const now = new Date ( '2024-06-14T20:00:00Z' ) ;
1337+
1338+ const utcResult = calculateStreak ( calendar , 'UTC' , now ) ;
1339+ const istResult = calculateStreak ( calendar , 'Asia/Kolkata' , now ) ;
1340+ const jstResult = calculateStreak ( calendar , 'Asia/Tokyo' , now ) ;
1341+
1342+ expect ( utcResult . todayDate ) . toBe ( '2024-06-14' ) ;
1343+ expect ( istResult . todayDate ) . toBe ( '2024-06-15' ) ;
1344+ expect ( jstResult . todayDate ) . toBe ( '2024-06-15' ) ;
1345+ } ) ;
13221346} ) ;
13231347
13241348describe ( 'isStreakAlive' , ( ) => {
You can’t perform that action at this time.
0 commit comments