javascript 最新的 2014 三星智能电视固件上的时区和夏令时问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25214742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 04:10:37  来源:igfitidea点击:

Timezone and DST problems on the latest 2014 Samsung Smart TV firmware

javascripttimezonedstsamsung-smart-tv

提问by Nikolay Mamaev

I have 2 Samsung Smart TVs with the following model and firmware (from TV Menu->Support->Contact Samsung screen)

我有 2 台具有以下型号和固件的三星智能电视(从电视菜单->支持->联系三星屏幕)

  1. 2013:

    • Model Code: UN32F5500
    • Software Vesrion: T-MST12AKUC-1121.3
  2. 2014:

    • Model Code: UN40H6350
    • Software Vesrion: T-MST14AKUC-1115.3
  1. 2013年:

    • 型号代码:UN32F5500
    • 软件版本:T-MST12AKUC-1121.3
  2. 2014年:

    • 型号代码:UN40H6350
    • 软件版本:T-MST14AKUC-1115.3

The first problem (reproduced on both TVs, 2013 & 2014) is the timezone is detection is wrong. The following code:

第一个问题(在 2013 年和 2014 年的两台电视上均重现)是时区检测错误。以下代码:

<script type='text/javascript' src='./$MANAGER_WIDGET/Common/af/../webapi/1.0/deviceapis.js'></script>
// ...
var timezone = deviceapis.tv.info.getTimeZone();
window.alert('Timezone=' + timezone.timezone + ', dst=' + timezone.dst);

outputs the following:

输出以下内容:

Timezone=2, dst=0

This is PL_TV_TIMEZONE_EASTERNwhereas I'm in the PST timezone, i.e. the following output is expected (5is PL_TV_TIMEZONE_PACIFIC, and daylight savings time is active now):

这是PL_TV_TIMEZONE_EASTERN我在 PST 时区,即预期以下输出(5is PL_TV_TIMEZONE_PACIFIC,并且夏令时现在处于活动状态):

Timezone=5, dst=1

The most weird thing is that I'm not able to change the TV's timezone and DST setting. If I go to the TV's Menu->System->Time->Clock, then the 'DST' and 'Time Zone' settings are disabled (grayed out) even if the 'Clock Mode' setting is set to 'Manual'.

最奇怪的是我无法更改电视的时区和 DST 设置。如果我转到电视的菜单->系统->时间->时钟,即使“时钟模式”设置为“手动”,“DST”和“时区”设置也会被禁用(变灰)。

The second problem is specific for the 2014 TV, it's not reproduced on the 2013 TV. The Date's getUTCHours()method returns wrong result not taking into account Daylight Saving Time Shift. That is, the following code:

第二个问题是针对 2014 年电视的,在 2013 年电视上没有重现。该DategetUTCHours()方法返回错误的结果没有考虑到夏令时移。也就是下面的代码:

var now = new Date();
window.alert('now: ' + now + '; getUTCHours()=' + now.getUTCHours());

produces the following output:

产生以下输出:

now: Fri Aug 08 2014 18:12:52 GMT-0800 (GMT), getUTCHours()=2

whereas the following is expected (as on my 2013 TV):

而预期如下(如我 2013 年的电视):

now: Fri Aug 08 2014 18:12:52 GMT-0700 (PDT); getUTCHours()=1

The current time (Fri Aug 08 2014 18:12:52) is correct but the DST offset is not taken into account in the returned GMT time's hour. Also, timezone code in the parenthesis is wrong (GMT instead of PDT or rather, taking into account timezone error described above, EDT or EST). I observed this problem just recently, I think it appeared after I made Software Update for the 2014 TV. I'd rather think this is a bug introduced in the latest version of the firmware. I tried to use TVplugin's (clsid:SAMSUNG-INFOLINK-TV) GetDST(), GetTimeZone(), GetTimeZone_Offset()functions, but all of them return incorrect results.

当前时间 ( Fri Aug 08 2014 18:12:52) 是正确的,但在返回的 GMT 时间的小时中不考虑 DST 偏移量。此外,括号中的时区代码是错误的(GMT 而不是 PDT,或者更确切地说,考虑到上述时区错误、EDT 或 EST)。我最近才发现这个问题,我认为它是在我为 2014 电视进行软件更新后出现的。我宁愿认为这是最新版本固件中引入的错误。我尝试使用TV插件的 ( clsid:SAMSUNG-INFOLINK-TV) GetDST(), GetTimeZone(),GetTimeZone_Offset()函数,但它们都返回错误的结果。

I'd very appreciate any help provided.

我非常感谢提供的任何帮助。

Thank you!

谢谢!

回答by Rick

I just contacted Samsung support, and they suggested that the Input had to be set to "TV" before entering setup to have access to the Timezone and the other parameters.

我刚刚联系了三星支持,他们建议在进入设置之前必须将输入设置为“电视”才能访问时区和其他参数。

回答by Matt Johnson-Pint

Well, it absolutely sounds like a firmware problem to me. I'd consider taking it up with their technical support. (Good luck.)

嗯,对我来说这绝对听起来像是固件问题。我会考虑接受他们的技术支持。(祝你好运。)

If time zone issues are important for your app and you're looking for a workaround, consider providing your own time zone data with your application. Assuming you can run any JavaScript you want, you should be able to use moment.jswith the moment-timezoneadd-on.

如果时区问题对您的应用程序很重要并且您正在寻找解决方法,请考虑在您的应用程序中提供您自己的时区数据。假设您可以运行任何您想要的 JavaScript,您应该能够使用带有moment-timezone附加组件的moment.js

回答by Mike with Samsung

Samsung supplied me with a link for my model that had me reset the Country Code to Virgin Islands, US, then back to US.

三星为我提供了我的模型的链接,让我将国家代码重置为美国维尔京群岛,然后返回美国。

This resets the apps & Timezone/date.

这将重置应用程序和时区/日期。

This fixed the issue for me.

这为我解决了这个问题。

If you have different models, you might want to contact Samsung Chat to get a link for yours.

如果您有不同的型号,您可能需要联系 Samsung Chat 以获取您的链接。

How to reset Country Code (Timezone) on my model per Samsung http://support-us.samsung.com/cyber/popup/iframe/pop_troubleshooting_fr.jsp?idx=428459&modelname=UN55F6300AF&modelcode=UN55F6300AFXZA

如何根据三星在我的模型上重置国家/地区代码(时区) http://support-us.samsung.com/cyber/popup/iframe/pop_troubleshooting_fr.jsp?idx=428459&modelname=UN55F6300AF&modelcode=UN55F6300AFXZA