浏览代码

Fixes #185 - wrong relative date

main
Eric Amodio 7 年前
父节点
当前提交
df5bf06646
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. +8
    -6
      src/system/date.ts

+ 8
- 6
src/system/date.ts 查看文件

@ -79,6 +79,11 @@ function buildDistanceInWordsLocale() {
function localize(token: string, count: number, options: any) {
options = options || {};
if (count === 12 && token === 'xMonths') {
token = 'aboutXYears';
count = 1;
}
const result = distanceInWordsLocale[token];
let value: string;
@ -86,11 +91,6 @@ function buildDistanceInWordsLocale() {
value = result;
}
else {
if (count === 12 && token === 'xMonths') {
token = 'aboutXYears';
count = 1;
}
if (count === 1) {
value = result.one;
}
@ -141,7 +141,9 @@ export namespace Dates {
export function toFormatter(date: Date): IDateFormatter {
return {
fromNow: () => _fromNow(date, formatterOptions),
fromNow: () => {
return _fromNow(date, formatterOptions);
},
format: (format: string) => _format(date, format)
};
}

正在加载...
取消
保存