Forum: Ruby on Rails How to get the browser date from a request, in Rails?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
05e4e83c87a5700958fcb3efa8951a06?d=identicon&s=25 vasudevram (Guest)
on 2007-01-19 16:30
(Received via mailing list)


We have a Rails app, standard kind, browser sending requests to the
Rails app on the server. We want to get (if possible) the
date/time/timezone of the machine on which the browser is running. This
is for some date/time calculations that we need to do.
Done some research on this. HTTP standard says that "Date:" is one of
the general HTTP headers. By checking, we found that:

a) it is not a requirement of the HTTP standard that a browser should
send this header, even though it is a defined and legal header.

b) not all browsers necessarily send this header; e.g.  Firefox 2.x on
Linux does not - we checked.

c) we dumped all the values in the request.env hash to screen, didn't
find the Date: header, though there were many other headers like

d) also dug around (some) in the Rails source, didn't find anything

We are looking at other workarounds (such as using a Javascript hack),
but may still want to try the above approach. Does anyone know if there
is any other way to get the Date: header, from the Rails environment
(maybe some lower level call), assuming, of course, that a browser does
send it?

Thanks for any help,
Vasudev Ram
This topic is locked and can not be replied to.