PhantomJS设置浏览器时区设置 [英] PhantomJS set browser timezone setting

查看:230
本文介绍了PhantomJS设置浏览器时区设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PhantomJS运行Karma以运行一些单元测试.

I am running Karma with PhantomJS to run some unit tests.

在我的单元测试中,有一些测试会进行一些日期比较,这些测试在本地运行时都会通过.

In my unit tests there are some tests which do some date comparison which all pass when run locally.

我们的构建服务器位于不同的时区,并且由于不同的时区而导致日期测试失败.

Our build server is on a different timezone and the date tests are failing due to different timezones.

我查看了phantomjs选项,但没有看到有关语言环境或时区的任何选项. 即使它们是不同的时区,是否也可以在每台计算机上将phantomJ配置为相同的时区?

I looked at phantomjs options to and didn't see any option regarding locale or timezone. Is it possible to configure phantomJs to the same timezone on every computer even though they are different timezones ?

推荐答案

如果使用外壳程序运行它,则可以使用

If you're running it using a shell, you might use the TZ environment variable. E.g.

TZ=Europe/Berlin phantomjs script.js

这篇关于PhantomJS设置浏览器时区设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆