stibbs
09/14/2021, 12:16 PMnow
is, like below.
My question: is there a built-in way of doing now
in PSQL?
ts
const now = new Date().getTime();
export const listPosts = async (): Promise<PostgrestResponse<PostTable>> => {
return supabase
.from<PostTable>('posts')
.select('*')
.gt('expires_at', now)
};
silentworks
09/14/2021, 12:31 PMNOW()
stibbs
09/14/2021, 12:39 PMts
export const listPosts = async (): Promise<PostgrestResponse<PostTable>> => {
return supabase
.from<PostTable>('posts')
.select('*')
.gt('expires_at', 'now()')
};
Steve
09/24/2021, 12:44 AM.gt('expires_at', 'yesterday')
or .gt('expires_at', 'tomorrow')
🙂
Those are special values in PostgreSQL, that's why they work(also they don't need parens)