小编Ker*_*ros的帖子

使用 NodaTime 将特定国家/地区日期时间转换为 UTC

我想通过提供国家/地区代码,使用 NodaTime 将特定日期时间值转换为 UTC。

例如,国家是土耳其,国家代码是 TR,具体日期时间是“2016 年 2 月 5 日 7:45 PM”,那么可能是“2016 年 2 月 5 日 5:45 PM”吗?

另外我的窗户位置不是土耳其。

先感谢您?

c# nodatime

5
推荐指数
1
解决办法
2544
查看次数

使用Appcelerator检测iPhone X.

我正在为我的项目使用自定义导航栏,我正在使用ios 7上边距的代码,如下所示;

var _IsIos7Plus = false;

if (Titanium.Platform.name == 'iPhone OS') {
    var _Version = Titanium.Platform.version.split(".");
    var _Major = parseInt(_Version[0], 10);

    if (_Major >= 7) {
        _IsIos7Plus = true;
    }
}

Alloy.Globals.Ios7TopMargin = _IsIos7Plus  == true ? 20 : 0;
Run Code Online (Sandbox Code Playgroud)

但iPhone X模拟器显示20个空白.有没有办法检测iPhone X?

iPhone X iOS 11.2截图

iPhone 8 iOS 11.2截图

titanium-mobile appcelerator-titanium

2
推荐指数
1
解决办法
764
查看次数

使用 underscorejs 进行多维排序

我的json结构如下;

var MyJson = 

[   
    {
        "Country": "Austria",
        "SubCategory": "55",
    }, {
        "Country": "Brazil",
        "SubCategory": "0",
    }, {
        "Country": "Canada",
        "SubCategory": "25",
    }, {
        "Country": "Cyprus",
        "SubCategory": "55",
    },  {
        "Country": "Denmark",
        "SubCategory": "0",
    }, {
        "Country": "France",
        "SubCategory": "25",
    }, {
        "Country": "Greece",
        "SubCategory": "55",
    }, {
        "Country": "Hungary",
        "SubCategory": "0",
    }
];
Run Code Online (Sandbox Code Playgroud)

我将其排序如下;

_.sortBy(MyJson, 'SubCategory').reverse()
Run Code Online (Sandbox Code Playgroud)

结果如下;

Greece  : 55
Cyprus  : 55
Austria : 55
France  : 25
Canada  : 25
Hungary : 0
Denmark : 0
Brazil …
Run Code Online (Sandbox Code Playgroud)

javascript json underscore.js

0
推荐指数
1
解决办法
35
查看次数