Skip to content

Instantly share code, notes, and snippets.

@syzer
Created January 19, 2018 16:02
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 syzer/7aebf9c873dffeac40d03e27349d9065 to your computer and use it in GitHub Desktop.
Save syzer/7aebf9c873dffeac40d03e27349d9065 to your computer and use it in GitHub Desktop.
today
const { padStart } = require('lodash')
const pad0 = e => padStart(e, 2, '0')
const date = new Date()
const today = [
date.getUTCFullYear(),
pad0(date.getUTCMonth() + 1),
pad0(date.getUTCDate())
].join('.')
// => 2018.01.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment