Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set format for durationFromNow? #88

Open
gusoskar opened this issue Feb 28, 2019 · 2 comments
Open

How do I set format for durationFromNow? #88

gusoskar opened this issue Feb 28, 2019 · 2 comments

Comments

@gusoskar
Copy link

I'm trying to set a format for the duration time, but I am unable to do so. The default format seems to be mm:ss, but I'd like to change that to (HH:mm:ss).

This is what I tried to do:
<Moment element={Text} date={this.props.start} format="HH:mm:ss" durationFromNow unix />

This only return the this.props.start (unix time) formatted as HH:mm:ss and seems to forget about the durationFromNow.

I also tried
<Moment element={Text} date={this.props.start} format="mm:ss" durationFromNow unix />

This returns 1,798:00

@Annihil
Copy link

Annihil commented Mar 15, 2019

I also wonder how

const now = new Date()
...
<Moment date={now} durationFromNow interval={1000} />

This returns x milliseconds before the first second has passed =/

@encbladexp
Copy link

@Annihil me too. I would assume that +/- 0.5 seconds are just 0 seconds. And all above is one second and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants