Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date columns aren't deserialized properly #179

Closed
danelkhen opened this issue Jan 9, 2017 · 5 comments
Closed

Date columns aren't deserialized properly #179

danelkhen opened this issue Jan 9, 2017 · 5 comments
Labels

Comments

@danelkhen
Copy link

Tested with sqlite driver only:

@Table()
export class MyRecord {
    @PrimaryColumn() key: string;
    @Column(CT.DATETIME, { nullable: true }) mtime: Date;
}

var x= {key:"gg", mtime:new Date()};
persist(x)

SQL

INSERT INTO "my_record"("key", "mtime") VALUES ($1,$2) -- PARAMETERS: ["gg","2017-1-9 11:50:4"]

2017-1-9 11:50:4 seems like a wrong value for the date parameter, But also after that - when loading the objects with typeorm the value of the property is of type string and not Date.

@Luke265
Copy link
Contributor

Luke265 commented Jan 9, 2017

Duplicate #177, I've also created PR #178, but i have to write tests, before this gets merged.

@danelkhen
Copy link
Author

Thanks, I saw your PR, but it only talked about storing the data, so I wasn't sure if it includes a fix to the fact that the value is not being converted during deserialization into an object. If this is the case we can close this one...

@Luke265
Copy link
Contributor

Luke265 commented Jan 10, 2017

I've updated my PR which now includes date, datetime, time deserialization into date object.

@danelkhen
Copy link
Author

👍 Great, thanks!

@pleerock
Copy link
Member

released in 0.0.7-alpha.10 please check if everything is working as expected there

@pleerock pleerock added the bug label Jan 12, 2017
Kononnable added a commit that referenced this issue Oct 10, 2019
Added support for UNSIGNED columns in MySQL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants