Skip to content

Fix string data in JST#3

Open
marocchino wants to merge 1 commit intokissy2go:masterfrom
marocchino:string-as-jst
Open

Fix string data in JST#3
marocchino wants to merge 1 commit intokissy2go:masterfrom
marocchino:string-as-jst

Conversation

@marocchino
Copy link
Copy Markdown

GMO API returns date value as JST string. I use 'tokyo' time zone in my rails.
But the changed time is utc So this difference causes a time lag in my app.

If incompatible with the existing operation is problem, you may want to let the user select the other in the configuration options something like this:

# config
GMO::PG.timezone = 'UTC' # or 'JST'

Time.strptime(@value, format) rescue return super
super
end
time.to_i rescue super
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we don't need to_i here.
just return Time type will be break nothing.

The timestamp should be explicitly changed to Time in Rails, which is quite painful.

[1] pry(main)> pr = Product.first
[2] pry(main)> pr.update(updated_at: 1234567890)
   (0.2ms)  BEGIN
  Product Update (1.0ms)  UPDATE "products" SET "updated_at" = $1 WHERE "products"."id" = $2  [["updated_at", nil], ["id", 4729]]
   (0.2ms)  ROLLBACK
ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR:  null value in column "updated_at" violates not-null constraint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant