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 PMstibbs
09/14/2021, 12:42 PMstibbs
09/14/2021, 12:43 PMts
export const listPosts = async (): Promise<PostgrestResponse<PostTable>> => {
return supabase
.from<PostTable>('posts')
.select('*')
.gt('expires_at', 'now()')
};stibbs
09/14/2021, 12:44 PMstibbs
09/14/2021, 12:44 PMSteve
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)