// timestamp is less than 60 minutes ago (display 1 hour ago rather than 60 minutes ago)
else if (this._timestamp < ($timestamp + 3540)) {
var $minutes = Math.max(Math.round((this._timestamp - $timestamp) / 60), 1);
- $element.text(eval(WCF.Language.get('wcf.date.relative.minutes')));
+ $element.text(WCF.Language.get('wcf.date.relative.minutes', { minutes: $minutes }));
}
// timestamp is less than 24 hours ago
else if (this._timestamp < ($timestamp + 86400)) {
var $hours = Math.round((this._timestamp - $timestamp) / 3600);
- $element.text(eval(WCF.Language.get('wcf.date.relative.hours')));
+ $element.text(WCF.Language.get('wcf.date.relative.hours', { hours: $hours }));
}
// timestamp is less than a week ago
else if (this._timestamp < ($timestamp + 604800)) {
var $days = Math.round((this._timestamp - $timestamp) / 86400);
- var $string = eval(WCF.Language.get('wcf.date.relative.pastDays'));
// get day of week
var $dateObj = WCF.Date.Util.getTimezoneDate(($timestamp * 1000), $offset);
var $dow = $dateObj.getDay();
+ var $day = WCF.Language.get('__days')[$dow];
- $element.text($string.replace(/\%day\%/, WCF.Language.get('__days')[$dow]).replace(/\%time\%/, $time));
+ $element.text(WCF.Language.get('wcf.date.relative.pastDays', { days: $days, day: $day, time: $time }));
}
// timestamp is between ~700 million years BC and last week
else {
<!-- variables for dynamic javascript datetime -->
<item name="wcf.date.relative.now"><![CDATA[Vor einem Moment]]></item>
- <item name="wcf.date.relative.minutes"><![CDATA['Vor ' + (($minutes > 1) ? $minutes + ' Minuten' : 'einer Minute' )]]></item>
- <item name="wcf.date.relative.hours"><![CDATA['Vor ' + (($hours > 1) ? $hours + ' Stunden' : 'einer Stunde' )]]></item>
- <item name="wcf.date.relative.pastDays"><![CDATA[(($days > 1) ? '%day%' : 'Gestern' ) + ', %time%']]></item>
+ <item name="wcf.date.relative.minutes"><![CDATA[{literal}Vor {if $minutes > 1}{#$minutes} Minuten{else}einer Minute{/if}{/literal}]]></item>
+ <item name="wcf.date.relative.hours"><![CDATA[{literal}Vor {if $hours > 1}{#$minutes} Stunden{else}einer Stunde{/if}{/literal}]]></item>
+ <item name="wcf.date.relative.pastDays"><![CDATA[{literal}{if $days > 1}{$day}{else}Gestern{/if}, {$time}{/literal}]]></item>
<!-- variables for localized date formats -->
<item name="wcf.date.hour"><![CDATA[Stunde]]></item>
<!-- variables for dynamic javascript datetime -->
<item name="wcf.date.relative.now"><![CDATA[A moment ago]]></item>
- <item name="wcf.date.relative.minutes"><![CDATA[(($minutes > 1) ? $minutes + ' minutes' : 'A minute') + ' ago']]></item>
- <item name="wcf.date.relative.hours"><![CDATA[(($hours > 1) ? $hours + ' hours' : 'An hour' ) + ' ago']]></item>
- <item name="wcf.date.relative.pastDays"><![CDATA[(($days > 1) ? '%day%' : 'Yesterday' ) + ', %time%']]></item>
+ <item name="wcf.date.relative.minutes"><![CDATA[{literal}{if $minutes > 1}{#$minutes} minutes{else}A minute{/if} ago{/literal}]]></item>
+ <item name="wcf.date.relative.hours"><![CDATA[{literal}{if $hours > 1}{#$hours} hours{else}An hour{/if} ago{/literal}]]></item>
+ <item name="wcf.date.relative.pastDays"><![CDATA[{literal}{if $days > 1}{$day}{else}Yesterday{/if}, {$time}{/literal}]]></item>
<!-- variables for localized date formats -->
<item name="wcf.date.hour"><![CDATA[Hour]]></item>