sequelize type time code example

Example 1: DataTypes Time sequelize

.... 
hour: {
            type: DataTypes.TIME,
            defaultValue: '00:00:00',
            field: 'hour'
        },
.....

Example 2: time sequelize

date: {
        type: DataTypes.DATEONLY(),
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('date', valueToBeSet)
        }
    },
    timeFrom: {
        type: DataTypes.TIME,
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('timeFrom', valueToBeSet)
        }
    },
    timeTo: {
        type: DataTypes.TIME,
        allowNull: false,
        set (valueToBeSet) { 
            this.setDataValue('timeTo', valueToBeSet)
        }
    },

Tags:

Misc Example