Varun's answer does not account for TimezoneOffset. Here is a version that does:
var d = new Date()
new Date(d.getTime() - d.getTimezoneOffset() * 60000).toJSON().slice(0, 10) // 2015-08-11
The TimezoneOffset
is minutes, while the Date constructor takes milliseconds, thus the multiplication by 60000
.