Skip to content

Commit 32863af

Browse files
committed
Fixed timestamp
1 parent 13b53d0 commit 32863af

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/formatstring/lib/timeLanguagePack.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"month": "month",
1414
"months": "months",
1515
"year": "year",
16-
"years": "years"
16+
"years": "years",
17+
"timestampFuture": "from now",
18+
"timestampPast": "ago"
1719
},
1820
"nl-nl": {
1921
"second": "seconde",
@@ -29,6 +31,8 @@
2931
"month": "maand",
3032
"months": "maanden",
3133
"year": "jaar",
32-
"years": "jaar"
34+
"years": "jaar",
35+
"timestampFuture": "vanaf nu",
36+
"timestampPast": "geleden"
3337
}
3438
}

src/formatstring/widget/formatstring.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ define('formatstring/widget/formatstring', ['dojo/_base/declare', 'mxui/widget/_
263263
_parseTimeAgo: function (value, data) {
264264
var date = new Date(value),
265265
now = new Date(),
266-
appendStr = (date > now) ? 'from now' : 'ago',
266+
appendStr = null,
267267
diff = Math.abs(now.getTime() - date.getTime()),
268268
seconds = Math.floor(diff / 1000),
269269
minutes = Math.floor(seconds / 60),
@@ -274,10 +274,13 @@ define('formatstring/widget/formatstring', ['dojo/_base/declare', 'mxui/widget/_
274274
years = Math.floor(months / 12),
275275
time = null;
276276

277+
time = this._timeData[dojo.locale];
278+
appendStr = (date > now) ? time.timestampFuture : time.timestampPast;
279+
277280
function createTimeAgoString(nr, unitSingular, unitPlural) {
278281
return nr + " " + (nr === 1 ? unitSingular : unitPlural) + " " + appendStr;
279282
}
280-
time = this._timeData[dojo.locale];
283+
281284
if (seconds < 60) {
282285
return createTimeAgoString(seconds, time.second, time.seconds);
283286
} else if (minutes < 60) {

test/widgets/FormatString.mpk

54 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)