File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 FloatingPortal ,
2222} from "@floating-ui/react" ;
2323import { PiCaretDownBold } from "react-icons/pi" ;
24+ import { subDays } from "date-fns" ;
2425import { setSearchParams } from "~/util/url" ;
2526import he from "he" ;
2627
@@ -73,6 +74,13 @@ function InfiniteHits(props: UseInfiniteHitsProps) {
7374 . map ( ( [ , value ] ) => value ) ;
7475
7576 const title = hierarchy ? hierarchy . join ( " > " ) : "Documentation" ;
77+ const today = new Date ( ) ;
78+ const futureDate = subDays ( today , item . lastModified ) ;
79+ const options : Intl . DateTimeFormatOptions = {
80+ year : "numeric" ,
81+ month : "long" ,
82+ day : "numeric" ,
83+ } ;
7684
7785 return (
7886 < a
@@ -84,6 +92,11 @@ function InfiniteHits(props: UseInfiniteHitsProps) {
8492 < p className = "line-clamp-2" >
8593 < Highlight attribute = "content" hit = { item } />
8694 </ p >
95+ { item . lastModified && (
96+ < span className = "text-cl1-gray-4! dark:text-cl1-gray-7! mt-2 text-sm" >
97+ { futureDate . toLocaleDateString ( "en-US" , options ) }
98+ </ span >
99+ ) }
87100 </ a >
88101 ) ;
89102 } ) }
You can’t perform that action at this time.
0 commit comments