nodejs, how to get client time zone info from its ServerRequest

4,698 views
Skip to first unread message

Yi

unread,
Oct 12, 2011, 11:22:24 AM10/12/11
to nodejs
Hi

Does anyone kown in NodeJS, is there any way, server side script can
retrieve client's time zone information from the ServerRequest object?

thanks

mscdex

unread,
Oct 12, 2011, 1:38:01 PM10/12/11
to nodejs
Not unless the client sends a custom header specifying their current
local time adjusted to GMT. The only other option would be to try and
do a GeoIP lookup on the IP address and determine the time zone based
on the resulting location.

Yi Tan

unread,
Oct 12, 2011, 2:58:00 PM10/12/11
to nod...@googlegroups.com

thanks, i'd go for the geoip solution because client has no access to request header. do you know is there any open source implementation for the geoip?

many thanks

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

mscdex

unread,
Oct 12, 2011, 3:42:29 PM10/12/11
to nodejs
On Oct 12, 2:58 pm, Yi Tan <yi2...@gmail.com> wrote:
> thanks, i'd go for the geoip solution because client has no access to
> request header. do you know is there any open source implementation for the
> geoip?

Here are a couple that are available on npm:

Native binding: http://search.npmjs.org/#/geoip (connect middleware
that uses this module available here: http://search.npmjs.org/#/connect-geoip)

Pure JavaScript module: http://search.npmjs.org/#/geoip-lite

Here is another native binding: https://github.com/strange/node-geoip

Yi Tan

unread,
Oct 13, 2011, 12:06:26 AM10/13/11
to nod...@googlegroups.com

that's really helpful, thanks a lot mate.

Reply all
Reply to author
Forward
0 new messages