rsnext/examples/cms-payload/utilities/timestamp.ts
Jessica Chowdhury cca9dd1297
examples: Add new cms-payload example. (#49616)
This PR adds `cms-payload` to the examples folder. The demo provides a
NextJS frontend, built with Payload, which can be deployed together in a
single instance.

### Improving Documentation or adding/fixing Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-16 07:32:51 -07:00

8 lines
248 B
TypeScript

export const timestamp = (label) => {
if (!process.env.PAYLOAD_TIME)
process.env.PAYLOAD_TIME = String(new Date().getTime())
const now = new Date()
console.log(
`[${now.getTime() - Number(process.env.PAYLOAD_TIME)}ms] ${label}`
)
}