How to create date in RFC3339 format in JavaScript

Datetime
Last updated Aug 15, 2018
const date = new Date();

const formatted = date.toISOString();
2018-08-15T13:05:25.239Z