Skip to content

Instantly share code, notes, and snippets.

@themeteorchef
Created January 22, 2016 14:47
Show Gist options
  • Save themeteorchef/1cecdfd03c54a7bcfa6a to your computer and use it in GitHub Desktop.
Save themeteorchef/1cecdfd03c54a7bcfa6a to your computer and use it in GitHub Desktop.
RFC-822 formatting for Moment.js
// RFC-822 formatting string for Moment.js.
let timestamp = 'ddd, DD MMM YYYY hh:mm:ss';
// Note, the "z" character responsible for setting the three-character timezone for a date in Moment.js is now deprecated.
// An easy workaround for this is to generate your date/time using the string above, appending the timezone manually.
//
// e.g. return `${ timestamp } CST`;
//
// Here, "CST" would need to be calculated on your own and would likely be a variable unless timezone is fixed.
@christian-schab
Copy link

I think it has to be
'ddd, DD MMM YYYY HH:mm:ss'
(with large H)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment