Update cookies.mdx to show that maxAge accepts a value in seconds (#66476)
In the discord server, people were confused whether maxAge accepts in second or millisecond. It would be worth specifying it --------- Co-authored-by: Sam Ko <sam@vercel.com>
This commit is contained in:
parent
12dbc8ad7e
commit
128e80ca59
1 changed files with 2 additions and 2 deletions
|
@ -121,7 +121,7 @@ async function delete(data) {
|
|||
|
||||
### `cookies().set(name, value, { maxAge: 0 })`
|
||||
|
||||
Setting `maxAge` to 0 will immediately expire a cookie.
|
||||
Setting `maxAge` to 0 will immediately expire a cookie. `maxAge` accepts a value in seconds.
|
||||
|
||||
```js filename="app/actions.js"
|
||||
'use server'
|
||||
|
@ -143,7 +143,7 @@ Setting `expires` to any value in the past will immediately expire a cookie.
|
|||
import { cookies } from 'next/headers'
|
||||
|
||||
async function delete(data) {
|
||||
const oneDay = 24 * 60 * 60 * 1000
|
||||
const oneDay = 24 * 60 * 60
|
||||
cookies().set('name', 'value', { expires: Date.now() - oneDay })
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue