website icon indicating copy to clipboard operation
website copied to clipboard

TIME datatype not documented

Open andreabianco opened this issue 9 years ago • 10 comments

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.

andreabianco avatar Oct 05 '16 05:10 andreabianco

I think you can use just the string 'TIME' as data type. But ideally we would have support for it.

felixfbecker avatar Oct 05 '16 08:10 felixfbecker

I confirm that Sequelize.TIME is working but it was not present in your documentation.

andreabianco avatar Oct 05 '16 10:10 andreabianco

Reminder that this needs to be updated in the documentation! I'll be using it for my project, thanks!

pmiri avatar May 23 '17 15:05 pmiri

@pmiri If you have an idea how to improve docs, feel free to do a PR to improve it

felixfbecker avatar May 23 '17 15:05 felixfbecker

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 🙂

stale[bot] avatar Jul 22 '17 20:07 stale[bot]

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?

dleppik avatar Nov 21 '17 17:11 dleppik

"PING". Would be nice to have some insight into the TIME datatype without having to guess and check.

2kreate avatar Apr 02 '18 03:04 2kreate

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?

nishant-dani avatar Apr 03 '19 01:04 nishant-dani

Please, add description of this feature in documentation.

alexeymkh avatar Oct 11 '19 21:10 alexeymkh

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.

erikrs92 avatar Sep 13 '20 07:09 erikrs92