Completed
Push — master ( b895c6...fa6d7b )
by Rain
03:32
created

ka.js ➔ ... ➔ moment.defineLocale(ꞌkaꞌ).ordinal   B

Complexity

Conditions 7
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 7
c 1
b 0
f 0
nc 4
dl 0
loc 12
rs 8.2222
nop 1
1
//! moment.js locale configuration
2
//! locale : Georgian [ka]
3
//! author : Irakli Janiashvili : https://github.com/irakli-janiashvili
4
5
;(function (global, factory) {
6
   typeof exports === 'object' && typeof module !== 'undefined'
7
       && typeof require === 'function' ? factory(require('../moment')) :
8
   typeof define === 'function' && define.amd ? define(['../moment'], factory) :
9
   factory(global.moment)
10
}(this, function (moment) { 'use strict';
11
12
13
    var ka = moment.defineLocale('ka', {
14
        months : {
15
            standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),
16
            format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')
17
        },
18
        monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
19
        weekdays : {
20
            standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'),
21
            format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'),
22
            isFormat: /(წინა|შემდეგ)/
23
        },
24
        weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
25
        weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
26
        longDateFormat : {
27
            LT : 'h:mm A',
28
            LTS : 'h:mm:ss A',
29
            L : 'DD/MM/YYYY',
30
            LL : 'D MMMM YYYY',
31
            LLL : 'D MMMM YYYY h:mm A',
32
            LLLL : 'dddd, D MMMM YYYY h:mm A'
33
        },
34
        calendar : {
35
            sameDay : '[დღეს] LT[-ზე]',
36
            nextDay : '[ხვალ] LT[-ზე]',
37
            lastDay : '[გუშინ] LT[-ზე]',
38
            nextWeek : '[შემდეგ] dddd LT[-ზე]',
39
            lastWeek : '[წინა] dddd LT-ზე',
40
            sameElse : 'L'
41
        },
42
        relativeTime : {
43
            future : function (s) {
44
                return (/(წამი|წუთი|საათი|წელი)/).test(s) ?
45
                    s.replace(/ი$/, 'ში') :
46
                    s + 'ში';
47
            },
48
            past : function (s) {
49
                if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) {
50
                    return s.replace(/(ი|ე)$/, 'ის წინ');
51
                }
52
                if ((/წელი/).test(s)) {
0 ignored issues
show
Complexity Best Practice introduced by
There is no return statement if წელი.test(s) is false. Are you sure this is correct? If so, consider adding return; explicitly.

This check looks for functions where a return statement is found in some execution paths, but not in all.

Consider this little piece of code

function isBig(a) {
    if (a > 5000) {
        return "yes";
    }
}

console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined

The function isBig will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly return undefined.

This behaviour may not be what you had intended. In any case, you can add a return undefined to the other execution path to make the return value explicit.

Loading history...
53
                    return s.replace(/წელი$/, 'წლის წინ');
54
                }
55
            },
56
            s : 'რამდენიმე წამი',
57
            m : 'წუთი',
58
            mm : '%d წუთი',
59
            h : 'საათი',
60
            hh : '%d საათი',
61
            d : 'დღე',
62
            dd : '%d დღე',
63
            M : 'თვე',
64
            MM : '%d თვე',
65
            y : 'წელი',
66
            yy : '%d წელი'
67
        },
68
        ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
69
        ordinal : function (number) {
70
            if (number === 0) {
71
                return number;
72
            }
73
            if (number === 1) {
74
                return number + '-ლი';
75
            }
76
            if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) {
77
                return 'მე-' + number;
78
            }
79
            return number + '-ე';
80
        },
81
        week : {
82
            dow : 1,
83
            doy : 7
84
        }
85
    });
86
87
    return ka;
88
89
}));