-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timestamp converstions #7
Comments
My current work around is to use the const { data, status } = useCollection<Message, Message>(
path,
{
refetchOnMount: 'always',
select: (x) =>
pipe(
x,
A.map((y) => ({
...y,
...pipe(
y.time,
O.fromNullable,
O.map((time) => ({
time: Timestamp.fromDate(
dayjs(time as unknown as string).toDate(),
),
})),
O.getOrElse(() => ({})),
),
})),
),
},
{
orderBy: ['time', 'desc'],
},
) |
@aminerol I ended up just using patch-package to remove I also noticed that querySnapshot.forEach((doc) => {
const docData = doc.data() ?? empty.object;
parseDates(docData);
const docToAdd = {
...docData,
id: doc.id,
exists: doc.exists,
hasPendingWrites: doc.metadata.hasPendingWrites,
__snapshot: ignoreFirestoreDocumentSnapshotField
? undefined
: doc,
} as Doc;
// update individual docs in the cache
queryClient.setQueryData(doc.ref.path, docToAdd);
data.push(docToAdd);
}); |
Hi @izakfilmalter ,
and yes |
It would be sick if this lib could output Timestamp as a Timestamp instead of as a string like what
swr-firestore
does.The text was updated successfully, but these errors were encountered: