[英]My Javascript works on Desktop but doesn't work on Mobile
first up i'm a newbie... I got the following Problem.首先,我是新手...我遇到了以下问题。
var rightNow = new Date();
var beginDate = new Date('Tue Nov 16, 2021 10:00:00 GMT+0100 (CET)');
var endDate = new Date('Tue Nov 30, 2021 24:00:00 GMT+0100 (CET)');
if (rightNow > beginDate && rightNow < endDate) {
console.log("Test");
}
I want the Script Inside only be working while its between beginDate and endDate.我希望 Script Inside 只在 beginDate 和 endDate 之间工作。 On Desktop it works totally fine like this but on Mobile it doesn't.
在桌面上,它可以像这样完全正常工作,但在移动设备上则不然。 Can anybody help me with this?
有人可以帮我解决这个问题吗?
Desktop I tested it on Chrome on a Mac.桌面 我在 Mac 上的 Chrome 上对其进行了测试。 Mobile with an iPhone and Safari
带有 iPhone 和 Safari 的移动设备
Best Regards此致
Sunke新客
Solution for that problem is just an other format for the date...该问题的解决方案只是日期的另一种格式......
var rightNow = new Date();
var beginDate = new Date('2021-11-16T10:00:00');
var endDate = new Date('2021-11-30T10:00:00');
if (rightNow > beginDate && rightNow < endDate) {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.