Code coverage report for src\components\filters\dateFactory.js

# all files / src/components/filters/ dateFactory.js

61.29% Statements 19/31
33.33% Branches 4/12
75% Functions 3/4
61.29% Lines 19/31

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    581×
    1×

    1×

    1×
    3×
    3×

    3×

    1×
    12×
    9×
    9×
    9×
    9×

    9×

    9×
    9×

    9×

    3×

    1×

     (function component(ng) {
      ng.module('components').factory('dateFactory', dateFactory);

      dateFactory.$inject = [];

      function dateFactory() {
        var context;
        var save;

        return {
            getDate: get,
            getTime: getTime
        };

        function get(ms) {
          if (ms != null) {
              var date = new Date(ms);
              var day = date.getDate();
              var month = date.getMonth() + 1;
              var year = date.getFullYear();

              Iif (day < 10) {
                day = '0' + day;
              }

              Eif (month < 10) {
                month = '0' + month;
              }

              return day + '.' + month + '.' + year;
            } else {
              return null;
            }
        }

        function getTime(ms) {
          if (ms != null) {
              var date = new Date(ms);
              var sec = date.getSeconds();
              var min = date.getMinutes();
              var hour = date.getHours();

              if (min < 10) {
                min = '0' + min;
              }

              if (sec < 10) {
                sec = '0' + sec;
              }

              return hour + ':' + min + ':' + sec;
            } else {
              return "";
            }
        }
      }
    })(angular);