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

moment gives wrong time 8-9 minutes after computer time #3863

Closed
nikocraft opened this issue Mar 25, 2017 · 3 comments
Closed

moment gives wrong time 8-9 minutes after computer time #3863

nikocraft opened this issue Mar 25, 2017 · 3 comments

Comments

@nikocraft
Copy link

Description of the Issue and Steps to Reproduce:
Moment returns time that is few minutes after time that my computer is showing.

This is how I set the time: var publishdate = moment().format('YYYY-MM-DD HH:MM');

Here is a video of it:
https://youtu.be/2ctTNhqYR0A

In the video you can see I am using bootstrap datetimepicker which it self uses momentjs, when I initialize the publishdate it's few minutes after what is on my computer, when I click in the datetimepicker and choose a date, correct time is then set.

Why does momentjs intialy give me wrong time and datepicker gives correct?

Please include the values of all variables used.

Environment:
Win 10 Chrome latest version

If you are reporting an issue, please run the following code in the environment you are using and include the output:

console.log(moment().format('YYYY-MM-DD HH:MM'))
console.log( (new Date()).toString())
console.log((new Date()).toLocaleString())
console.log( (new Date()).getTimezoneOffset())
console.log( navigator.userAgent)
console.log(moment.version)

output

2017-03-25 12:03
create: Sat Mar 25 2017 12:37:19 GMT+0100 (Romance Standard Time)
create: 3/25/2017, 12:37:19 PM
create: -60
create: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
create: 2.18.1
@marwahaha
Copy link
Member

Its possible this is a Bootstrap Datepicker bug. Which Datepicker are you using? Do they have a Github repository?

@nikocraft
Copy link
Author

i doubt that it has to do with datetimepicker since this line:

console.log(moment().format('YYYY-MM-DD HH:MM')) gives
2017-03-25 12:03

and time on computer was 12:37 or something close to that, datetime picker gives correct time when it inserts time into the input box.

anyways I am using:

https://github.com/Eonasdan/bootstrap-datetimepicker

@icambron
Copy link
Member

var publishdate = moment().format('YYYY-MM-DD HH:MM');

That second MM should be mm because MM means month and mm means minute.

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