ruby on rails - How can I display the correct created and modified times in my webapp? -


I am working on a rail application which is similar to a blog, creating user entries How do I set time storage and display I am trying to know what to handle. I have read about the time zone support of the train.

It's great but it was not told what my app should do. It looks only on those cases where you want to store the stored time in the current user's time zone. On the contrary, I want to effect ...

  • A user creates an entry in California at 10:00

  • After some years he will go to New York and then at some point his old entry will be seen. "Created" Date "should be called 10:00 AM" He does not care about time zone. He just wants to know what he felt about the time of the day when he wrote the entry.

  • If he displays the "modified" date in New York, then again, his subject-matter of the day when he edited. (Suppose it went to "priority" and changed the setting of its time zone settings.)

  • Also, for completeness, able to report the app Should be "real" full time when an entry was created or updated.

(Note - my imaginary user is a boy, but for women it should work in almost the same way.)

The way I'm thinking of implementing it ...

  • The attributes are user # time_zone , standard created_at and Additional entry of updated_at # made_t_utc and entry # updated_t_utc .

  • When users sign up, the user chooses their time zone from a menu (if they wish they can change it later.)

  • To store the app created_at , user # time_jone and update_at in the user's subjective local time. If this is for them at 10:00, then the app writes "10:00 p.m." for DB.

  • The app also prevents the current UTC time in the above _utc areas to deal with the above requirement.

Is this a good way to do it? Is there a better way?

If you can, you should avoid storing time of two separate sets, And you should avoid storing any non-UTC dates. Both of these things will cause confusion. I am not completely sure that I understand what you are doing (although I like your view of subjective time), but it will not be enough to engage the time zone in each post, Will display time to use? This will be the default for the time zone in the author's account, so it can change when carrying a cross-country without affecting the previous post.

I think that you need - every post to engage a time zone is it enough? Or am I forgetting some part of this?


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -