recoder-code
Version:
π AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!
83 lines β’ 1.81 kB
JavaScript
var formatDistanceLocale = {
lessThanXSeconds: {
one: 'ε°ζΌ 1 η§',
other: 'ε°ζΌ {{count}} η§'
},
xSeconds: {
one: '1 η§',
other: '{{count}} η§'
},
halfAMinute: 'εει',
lessThanXMinutes: {
one: 'ε°ζΌ 1 ει',
other: 'ε°ζΌ {{count}} ει'
},
xMinutes: {
one: '1 ει',
other: '{{count}} ει'
},
xHours: {
one: '1 ε°ζ',
other: '{{count}} ε°ζ'
},
aboutXHours: {
one: 'ε€§η΄ 1 ε°ζ',
other: 'ε€§η΄ {{count}} ε°ζ'
},
xDays: {
one: '1 倩',
other: '{{count}} 倩'
},
aboutXWeeks: {
one: 'ε€§η΄ 1 εζζ',
other: 'ε€§η΄ {{count}} εζζ'
},
xWeeks: {
one: '1 εζζ',
other: '{{count}} εζζ'
},
aboutXMonths: {
one: 'ε€§η΄ 1 εζ',
other: 'ε€§η΄ {{count}} εζ'
},
xMonths: {
one: '1 εζ',
other: '{{count}} εζ'
},
aboutXYears: {
one: 'ε€§η΄ 1 εΉ΄',
other: 'ε€§η΄ {{count}} εΉ΄'
},
xYears: {
one: '1 εΉ΄',
other: '{{count}} εΉ΄'
},
overXYears: {
one: 'θΆ
ι 1 εΉ΄',
other: 'θΆ
ι {{count}} εΉ΄'
},
almostXYears: {
one: 'ε°θΏ 1 εΉ΄',
other: 'ε°θΏ {{count}} εΉ΄'
}
};
var formatDistance = function formatDistance(token, count, options) {
var result;
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === 'string') {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace('{{count}}', String(count));
}
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return result + 'ε
§';
} else {
return result + 'ε';
}
}
return result;
};
export default formatDistance;