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

Annoying moment.js deprecation warning #25

Open
dandv opened this issue Aug 5, 2014 · 7 comments
Open

Annoying moment.js deprecation warning #25

dandv opened this issue Aug 5, 2014 · 7 comments
Milestone

Comments

@dandv
Copy link
Collaborator

dandv commented Aug 5, 2014

The moment library is moving away from accepting constructors of the form moment(timestamp). A time format must be passed. There are three lines of code that use the old syntax:

https://github.com/mattbradley/livestampjs/blob/master/livestamp.js#L27
https://github.com/mattbradley/livestampjs/blob/master/livestamp.js#L30
https://github.com/mattbradley/livestampjs/blob/master/livestamp.js#L94

timestamp is a string at that point in code, e.g. Tue Aug 05 2014 15:50:37 GMT-0700 (Pacific Daylight Time)", which seems brittle. Could it be the UNIX timetamp in seconds instead, or a Date object?

@dandv dandv changed the title moment.js deprecation warning Annoying moment.js deprecation warning Aug 5, 2014
@elgrafico
Copy link

+1

2 similar comments
@hgtesta
Copy link

hgtesta commented Nov 9, 2014

+1

@philfreo
Copy link
Collaborator

👍

@mattbradley
Copy link
Owner

Will fix in v2.0.

@mattbradley mattbradley added this to the 2.0 milestone Apr 24, 2015
@KrunchMuffin
Copy link

This wasn't working for me, had to change Line 19 to be

timestamp = moment.unix(timestamp);

you have to use unix as of 1.6 I am on 2.10.3

UPDATE: If I use UNIX_TIMESTAMP(time) from MySQL, I don't need the unix, but if I convert the date in the application with coldfusion, I do need it.

@onedr0p
Copy link

onedr0p commented Feb 7, 2016

So long to change this simple fix!

+1

@manifestinteractive
Copy link

Submitted Pull Request #55 for those that want an easy solution. In short, Moment.js no longer likes dates as strings ... so they need to be converted into an object first. Quick three line change will hopefully get reviewed ASAP :) Until then, you can check out my PR branch for the fix.

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

8 participants