Ignore Time Zone Angularjs

后端 未结 3 447
别跟我提以往
别跟我提以往 2021-01-02 19:18

Is there a better way to ignore an timezone in Angularjs:

\"2014-01-18 14:30:00\" Instead Of \"2014-01-18 15:30:00\"

function Scoper($scope) {
    $         


        
3条回答
  •  执笔经年
    2021-01-02 20:05

    I Have the solution:

    app.filter('timezone', function(){
    
     return function (val, offset) {
            if (val != null && val.length > 16) {
        return val.substring(0, 16)
    }    
    return val;
        };
    });
    

    template:

     {{ date | timezone | date:'yyyy-MM-dd HH:mm:ss' }}
    

    http://jsfiddle.net/samibel/n4CuQ/

提交回复
热议问题