Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Feature: Add flag to format unix timestamps into Javascript Date timestamps #20

Closed
jordond opened this issue Jun 5, 2019 · 2 comments
Closed
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jordond
Copy link
Member

jordond commented Jun 5, 2019

Right now the response that comes back from DarkSky will not create the correct date in javascript. You have to do this:

const { dt } = forecast.current
const data = new Date(dt * 1000) 

It would be nice to have an optional flag that would convert the response automatically.

Something like:

new DarkSky('token', { formatTimestamp: true })
@jordond jordond added the enhancement New feature or request label Jun 5, 2019
@nschild
Copy link

nschild commented Nov 20, 2019

or even better, provide a wrapper function for dates:

new DarkSky('token', { formatTimestamp: (timestamp) => timestamp * 1000 })

new DarkSky('token', { formatTimestamp: (timestamp) => new Date(timestamp * 1000) })

new DarkSky('token', { formatTimestamp: (timestamp) => moment(timestamp * 1000).format('h:mma') })

@jordond jordond added good first issue Good for newcomers help wanted Extra attention is needed labels Dec 13, 2019
@jordond
Copy link
Member Author

jordond commented Apr 2, 2020

Closing because of #385

@jordond jordond closed this as completed Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants