website
website copied to clipboard
TIME datatype not documented
Hi All,
I'm using Sequelize with MySql and I need to use the datatype TIME in one of mine model. From the documentation, I know that Sequelize supports only DATA and DATEONLY but I didn't find a way to insert only the time.
Can you suggest me a solution for it? Thanks.
I think you can use just the string 'TIME' as data type. But ideally we would have support for it.
I confirm that Sequelize.TIME is working but it was not present in your documentation.
Reminder that this needs to be updated in the documentation! I'll be using it for my project, thanks!
@pmiri If you have an idea how to improve docs, feel free to do a PR to improve it
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
Still an issue, and the lack of documentation leaves much to the imagination. For example, does it take strings or JS Date objects? If it takes Dates, does it extract the time using the local time or GMT? And, of course, is this behavior consistent for every supported database?
"PING". Would be nice to have some insight into the TIME datatype without having to guess and check.
How does one work with the TIME datatype? Pass in a time string similar to 20:45:08-07:00 fails saying that is not in a recognized format. Non RFC2822/ISO date formats are discouraged. Is SEQUELIZE expecting the full Date to be specified, even though it is defined as a TIME column?
Please, add description of this feature in documentation.
This working for me: in my model of sequelize, in back.
for column: "hour"
....
hour: {
type: DataTypes.TIME,
defaultValue: '00:00:00',
field: 'hour'
},
.....
And en my Front. We are using Java.
...
@JsonFormat(pattern="HH:mm:ss")
private LocalTime hour;
...
and in Mysql Column data type is:
TIME
And this is all, work for me.