This repository was archived by the owner on Feb 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 66 addMinutesUTC ,
77 addMonthsUTC ,
88 differenceDaysUTC ,
9+ differenceHoursUTC ,
10+ differenceMinutesUTC ,
911 displayDayDetails ,
1012 displayFullMonth ,
1113 displayHourDetails ,
@@ -19,6 +21,7 @@ import {
1921 stringToUTCTimestamp ,
2022 subDaysUTC ,
2123 subMonthsUTC ,
24+ timestampDisplay ,
2225 UTCNow ,
2326 UTCTimestamp ,
2427} from '../../utils/DateTimeUtils' ;
@@ -137,19 +140,19 @@ export const datesFromChartPeriod = (
137140) : UTCTimestamp [ ] => {
138141 switch ( period ) {
139142 case 'day' :
140- return Array ( 24 )
143+ return Array ( differenceHoursUTC ( to , from ) + 1 )
141144 . fill ( from )
142145 . map ( ( _ , i ) => addHoursUTC ( _ , i ) ) ;
143146 case 'realtime' :
144- return Array ( 31 )
147+ return Array ( differenceMinutesUTC ( to , from ) + 1 )
145148 . fill ( from )
146149 . map ( ( _ , i ) => addMinutesUTC ( _ , i ) ) ;
147150 case '7d' :
148- return Array ( 7 )
151+ return Array ( differenceDaysUTC ( to , from ) + 1 )
149152 . fill ( from )
150153 . map ( ( _ , i ) => addDaysUTC ( _ , i ) ) ;
151154 case '30d' :
152- return Array ( 30 )
155+ return Array ( differenceDaysUTC ( to , from ) + 1 )
153156 . fill ( from )
154157 . map ( ( _ , i ) => addDaysUTC ( _ , i ) ) ;
155158 case 'month' :
Original file line number Diff line number Diff line change 44 addMinutes ,
55 addMonths ,
66 differenceInCalendarDays ,
7+ differenceInHours ,
8+ differenceInMinutes ,
79 getDaysInMonth ,
810 isSameMinute ,
911 isToday ,
@@ -191,6 +193,12 @@ export const getDaysInMonthFromTimestamp = (value: UTCTimestamp): UTCTimestamp =
191193export const differenceDaysUTC = ( left : UTCTimestamp , right : UTCTimestamp ) : number =>
192194 differenceInCalendarDays ( new Date ( left ) , new Date ( right ) ) ;
193195
196+ export const differenceMinutesUTC = ( left : UTCTimestamp , right : UTCTimestamp ) : number =>
197+ differenceInMinutes ( new Date ( left ) , new Date ( right ) ) ;
198+
199+ export const differenceHoursUTC = ( left : UTCTimestamp , right : UTCTimestamp ) : number =>
200+ differenceInHours ( new Date ( left ) , new Date ( right ) ) ;
201+
194202export const getMinutesUTC = ( value : UTCTimestamp ) : UTCTimestamp => {
195203 const elements = dateToUTCElements ( new Date ( value ) ) ;
196204
You can’t perform that action at this time.
0 commit comments