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:
Anay Paraswani 2024-06-03 05:04:00 +05:30 committed by GitHub
parent 12dbc8ad7e
commit 128e80ca59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 })
}
```