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

Modified: date error when editing comment #151

Open
yunierescobar opened this issue Mar 11, 2019 · 0 comments
Open

Modified: date error when editing comment #151

yunierescobar opened this issue Mar 11, 2019 · 0 comments

Comments

@yunierescobar
Copy link

yunierescobar commented Mar 11, 2019

There is a detail in the add-on code that causes it to return the date in milliseconds when a comment is edited and then generates problems when formatting the editing date with moment.

The request I found is to replace the date in milliseconds with the ISO format that gives the current date and time in UTC:

modified: new Date().toISOString()

You have to update this:

var commentJSON = $.extend({}, this.commentsById[textarea.attr('data-comment')]); $.extend(commentJSON, { parent: textarea.attr('data-parent') || null, content: this.getTextareaContent(textarea), pings: this.getPings(textarea), modified: new Date().toISOString() //This is the update code });

Then it is possible to format the date without problems in the following way:

timeFormatter: function (time) { moment.locale('es'); return moment.utc(time, 'YYYY-MM-DD HH:mm:ss').local().fromNow(); }

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

1 participant