It needs to be set on the server. You could do an AJAX call.
HTH,
Bill
Or, you could do this all in JavaScript, and simply translate the
dates in the browser. Store -- and display -- one time zone, like UTC.
But then on the client, collect all your dates (wrap them in a
span.date or something that you can get using JS) and use the client's
notion of the time zone to adjust their display on screen.
$$('span.date').each(function(elm){
var d = new Date();
var offset = d.getTimeZoneOffset() * 3600 * 1000;
var adjusted = new Date(elm.innerHTML);
adjusted.setTime(adjusted.getTime() + offset);
elm.update(adjusted.toLocaleDateString());
});
Walter
>
> HTH,
> Bill
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-
> ta...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>
You can use "render :nothing => true" instead
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/E7glokNtpDcJ.
To post to this group, send email to rubyonra...@googlegroups.com.
Are you sure you're using the latest version of the
detect_timezone.js? When I was working on this I downloaded another
older version that didn't define the class jstz namespace.
> I forgot to downloadhttps://bitbucket.org/pellepim/jstimezonedetect/downloadsdetect_timez....
>
>
>
>
>
>
>
> On Sat, Jul 16, 2011 at 2:22 PM, DHAMODHARAN N <dhams...@gmail.com> wrote:
> > Hello friends,
>
> > I am trying to get timezone in browser produce below error.
> > jstz is not defined
> > jstz.set_timezone_in_session = function () {
>
> > My code:
>
> > jstz.set_timezone_in_session = function () {
> > $.post("/timezone/set", { timezone:
> > jstz.determine_timezone().timezone.olson_tz } );
> > }
> > onload = jstz.set_timezone_in_session();
>
> > I am using JQuery.
>
> > If any one known about this suggestion me.
>
> > Thanks,
> > Dhamodharan.N
>