File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 1111
1212import React from 'react' ;
1313import _ from 'lodash' ;
14- import { format , parseISO } from 'date-fns' ;
14+ import { intlFormat } from 'date-fns' ;
1515import {
1616 CartesianGrid ,
1717 Legend ,
@@ -109,20 +109,29 @@ const BlocksChart = (props: BlocksChartProps) => {
109109 } ) ;
110110
111111 const timestampFormat = ( timestamp : number ) : string => {
112- return format (
113- parseISO ( new Date ( timestamp * 1000 ) . toISOString ( ) . slice ( 0 , - 1 ) ) ,
114- 'M/d/yyyy, hh:mm aa'
115- ) ;
112+ return intlFormat ( new Date ( timestamp * 1000 ) , {
113+ year : 'numeric' ,
114+ month : 'numeric' ,
115+ day : 'numeric' ,
116+ hour : 'numeric' ,
117+ minute : 'numeric' ,
118+ timeZone : 'UTC' ,
119+ } ) ;
116120 } ;
117121
118122 const tooltipFormatter = ( value , name ) => {
119123 if ( name === 'Difficulty' ) {
120124 return value ;
121125 } else if ( name === 'Time' ) {
122- return format (
123- parseISO ( new Date ( value * 1000 ) . toISOString ( ) . slice ( 0 , - 1 ) ) ,
124- "MMMM d, yyyy 'at' hh:mm aa 'UTC'"
125- ) ;
126+ return intlFormat ( new Date ( value * 1000 ) , {
127+ day : 'numeric' ,
128+ month : 'long' ,
129+ year : 'numeric' ,
130+ hour : 'numeric' ,
131+ minute : '2-digit' ,
132+ timeZone : 'UTC' ,
133+ timeZoneName : 'short' ,
134+ } ) ;
126135 }
127136 return value ;
128137 } ;
You can’t perform that action at this time.
0 commit comments