Quick question about TRPC query with date

Hi, Just a quick question about TRPC Query why do I always get the same date in the query? Date in this case is a state. How do I make it work when I change the date to re-trigger this query? I tried refetch but did not work same date again.
20 Replies
neochrome
neochromeOP3y ago
This is the date I always get when selected in a calendar
Piotrek
Piotrek3y ago
I think setting the state should automatically run the query again Can you show the code when you set / change the date?
cje
cje3y ago
where does date come from? this is a a react question, not a trpc/react query question, btw
neochrome
neochromeOP3y ago
its a react/trpc you are right @cje
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
this is how i set the date
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
this is the component and what happens on click and below i have state output
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
but the thing thats input in the TRPC is always this so I'm hella confused i think its the format
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
how can I do this in trpc?
cje
cje3y ago
it has nothing to do with trpc have you tried logging the date before the query is created?
neochrome
neochromeOP3y ago
yes you see the date in TRPC is TZ format thingy and mine on the frontend is the normal one so I suppose TRPC expects me to have a TZ Iso format and not the default one?
cje
cje3y ago
why would that make it stale
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
why by default is the date saved like this lol ? I need to find posts where datetimes are between date-fns.startOfDay(date) and date-fns.endOfDaty(date)
neochrome
neochromeOP3y ago
neochrome
neochromeOP3y ago
its working now
Want results from more Discord servers?
Add your server