Skip to content

Instantly share code, notes, and snippets.

@neilsonlima
Last active February 16, 2020 19:39
Show Gist options
  • Save neilsonlima/14661b489b597d1721ef0743fa99504f to your computer and use it in GitHub Desktop.
Save neilsonlima/14661b489b597d1721ef0743fa99504f to your computer and use it in GitHub Desktop.
'use strict'
const moment = require('moment')
moment.locale('pt-BR')
let now = moment()
let hour = Number(now.format('HH'))
now.set({'hour': 21, 'minute': 0, 'second': 0, 'millisecond': 0})
if( !(hour >= 21 && hour <= 23) ){
now.subtract(1, 'days')
}
let timestamp = now.valueOf()
console.log("timestamp: ", timestamp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment