Browse Source

fix date

main
matthew 2 years ago
parent
commit
329863190e
  1. 3
      searching-front/app/core/pages/State/State.tsx
  2. 6
      searching-front/app/stateSites/queries/getLastWeekNewSites.ts

3
searching-front/app/core/pages/State/State.tsx

@ -89,6 +89,7 @@ const State = ({
historyOfState: historyOfStatePreloaded,
lastWeekNewSites,
}: StatePageProps) => {
const nowDate = format(new Date(),'d MMMM').toLowerCase();
const [historyPeriod, setHistoryPeriod] = useState(InfluxPeriod.D)
const { t } = useTranslation()
const [historyOfState] = useQuery(getHistoryOfSitesState, historyPeriod, {
@ -105,7 +106,7 @@ const State = ({
<span className={s.allCount}>/ {actualState.allDomainsCount}</span>
<div className={s.counterFooter}>
<div className={s.areNowAvailable}>{t("state.areNowAvailable")}</div>
<div className={s.counterDate}>9 september</div>
<div className={s.counterDate}>{nowDate}</div>
</div>
</div>
</div>

6
searching-front/app/stateSites/queries/getLastWeekNewSites.ts

@ -2,14 +2,12 @@ import { subDays } from "date-fns"
import db from "db"
export default async function getLastWeekNewSites() {
const weekAgo = subDays(new Date(), 7)
const lastWeekNewSites = await db.nftDomain.findMany({
orderBy: { firstAvailableDate: "desc" },
take: 10,
where: { available: true, AND: { firstAvailableDate: { gt: weekAgo } } },
where: { available: true },
})
console.log(lastWeekNewSites)
return {
lastWeekNewSites,
}

Loading…
Cancel
Save