Skip to content

Instantly share code, notes, and snippets.

View adsonrocha's full-sized avatar

Adson Rocha adsonrocha

View GitHub Profile
@ziglee
ziglee / routes.js
Last active August 21, 2021 15:05
Listing all Costumers with birthday today or tomorrow using Sequelize.js.
router.get('/api/birthday', function (req, res, next) {
var month = moment().month() + 1;
var today = moment().date();
var tomorrow = moment().add(1, 'days').date();
Costumer.findAll({
attributes: ['id','name','birthDate'],
where: {
$and: [
sequelize.where(sequelize.fn('month', sequelize.col("birth_date")), month)
],