File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,13 @@ const getDate = (event: EventType) => {
133133
134134 if ( _ . isNumber ( date ) ) {
135135 // Typesense date is a Unix timestamp, which is in seconds, so convert to ms
136- return new Date ( date * ONE_SECOND ) ;
136+ const jsDate = new Date ( date * ONE_SECOND ) ;
137+ // prevent timezone errors by just using year, month, date
138+ return new Date (
139+ jsDate . getUTCFullYear ( ) ,
140+ jsDate . getUTCMonth ( ) ,
141+ jsDate . getUTCDate ( )
142+ ) ;
137143 }
138144
139145 return date ;
Original file line number Diff line number Diff line change @@ -199,3 +199,23 @@ export const ListView = () => {
199199 </ >
200200 ) ;
201201} ;
202+
203+ // example of a single date at the exact beginning of the range, which
204+ // was causing errors due to timezone conversion
205+ const singleDate = {
206+ end_date : [ - 662688000 , - 631152000 ] ,
207+ end_year : [ 1949 , 1950 ] ,
208+ name : 'African Progressive Association Founded' ,
209+ start_date : [ - 946771200 , - 915148800 ] ,
210+ start_year : [ 1940 , 1941 ] ,
211+ uuid : '52f568cb-3036-478f-8a0c-62e93c1f0f20'
212+ } ;
213+
214+ export const SingleItem = ( ) => (
215+ < FacetTimeline
216+ data = { [ singleDate ] }
217+ range = { { min : 1940 , max : 1954 } }
218+ refine = { action ( 'refine' ) }
219+ start = { [ 1940 , 1954 ] }
220+ />
221+ ) ;
You can’t perform that action at this time.
0 commit comments