Skip to content

Instantly share code, notes, and snippets.

@cdl
Created March 8, 2016 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdl/b13d1b92ba3222adf943 to your computer and use it in GitHub Desktop.
Save cdl/b13d1b92ba3222adf943 to your computer and use it in GitHub Desktop.
// march 1 at 2:34pm
var date = moment('1456868040000', 'x');
// get start of day
var start = date.startOf('day');
start.format('LT LL'); // => 12:00 AM March 1, 2016
// You'd think this'd still be 2:34PM but nope.
date.format('LT LL'); // => 12:00 AM March 1, 2016
// WHY THE HECK DOES .startOf MUTATE THE ORIGINAL DATE INSTEAD OF JUST
// RETURNING THE MODIFIED DATE ??????
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment