srushti / goldberg

Goldberg is a lightweight CI server written in Ruby which worries about Bundler & RVM so that you don't have to.
Other
242 stars 29 forks source link

timestamps in local time zone #37

Closed professor closed 12 years ago

professor commented 13 years ago

Although I like how the build timestamps are shown in UTC, I'd like to be able to configure goldberg to show the time in my local time zone. I was tempted to add in this code, but I wasn't sure how the group felt about this item.

srushti commented 13 years ago

That's definitely something we want to get done. We can have the requested timezone specified in config/goldberg.yml. If you'd like to do it go right ahead, if not we'll get to it soon.

aakashd commented 13 years ago

Rather than mentioning the timezone in config, shouldn't we get the timezone from request and show the date for that timezone?

professor commented 13 years ago

Personally, I would just modify the view to show the timestamp in the user's local timezone as defined by the machine that is running goldberg. Thus if my machine is in UTC-8, then the timestamps would all be in local time.

I suspect that this is behavior that 95% of your users would want. I wanted to check in with you before modifying the code myself to see if you agree.

There is (of course) an edge case, but I don't know if it is worth solving. If I'm on a distributed team with people all over the world, then I don't know what the exact behavior should be. Perhaps there is a javascript way to convert UTC into a local time zone.

Any thoughts?

srushti commented 13 years ago

Well, personally a lot of our (at C42) projects are usually distributed (at least, with the clients being in another part of the world), so it's not quite an edgecase for us. Therefore, being able to pick up the browser's timezone would be something that would appeal to us, so @aakashd is right. I just wasn't sure if we wanted to expend the effort to do that just now, or if we could get to that later. So, a basic solution could be being able to set the timezone statically. But if you could do the complete solution (where the statically set timezone works as a default) that would be great. And you're right, there should be a way to get the date through javascript, I'm sure jquery gives you convenient methods to access the client machine's time. In fact, with a quick google I just found https://github.com/hwki/jQuery-Timezone (I've never tried it, so I don't know if it's any good).

srushti commented 13 years ago

I'm moving this to 2.0 since we already have the relative timestamps. We can revisit this at a later date.

srushti commented 12 years ago

Like I'd mentioned earlier the timeago plugin solves most of the problem. Other than that, we still have the UTC timestamp as a title (tooltip) for all the builds (where timeago might not be super-useful) but where the timezone itself doesn't matter a great deal.

I'm closing this assuming local timestamps (local to the browser) aren't necessary. Let me know if that's not the case.