Bufferline timestamps now try to detect locale
This commit is contained in:
parent
a3a05983fc
commit
a0485b5801
|
@ -289,7 +289,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<tr class="bufferline">
|
<tr class="bufferline">
|
||||||
<td class="time">
|
<td class="time">
|
||||||
<span class="date" ng-class="::{'repeated-time': bufferline.shortTime==bufferlines[$index-1].shortTime}">
|
<span class="date" ng-class="::{'repeated-time': bufferline.shortTime==bufferlines[$index-1].shortTime}">
|
||||||
<span class="cof-chat_time cob-chat_time coa-chat_time" ng-bind="::(bufferline.date|date:'HH')"></span><span class="cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters">:</span><span class="cof-chat_time cob-chat_time coa-chat_time" ng-bind="::(bufferline.date|date:'mm')"></span><span class="seconds"><span class="cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters">:</span><span class="cof-chat_time cob-chat_time coa-chat_time" ng-bind="::(bufferline.date|date:'ss')"></span></span>
|
<span class="cof-chat_time cob-chat_time coa-chat_time timestamp-no-seconds" ng-bind-html="::bufferline.formattedTime"></span>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span class="hidden-bracket"><</span><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text|prefixlimit:25"></span><span class="hidden-bracket">></span></a></td><!--
|
<td class="prefix"><a ng-click="addMention(bufferline.prefix)"><span class="hidden-bracket"><</span><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text|prefixlimit:25"></span><span class="hidden-bracket">></span></a></td><!--
|
||||||
|
|
19
js/models.js
19
js/models.js
|
@ -347,6 +347,24 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
var buffer = message.buffer;
|
var buffer = message.buffer;
|
||||||
var date = message.date;
|
var date = message.date;
|
||||||
var shortTime = $filter('date')(date, 'HH:mm');
|
var shortTime = $filter('date')(date, 'HH:mm');
|
||||||
|
var formattedTime = "";
|
||||||
|
|
||||||
|
if ($rootScope.supports_formatting_date) {
|
||||||
|
formattedTime = date.toLocaleTimeString([], {hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit"});
|
||||||
|
} else {
|
||||||
|
formattedTime = $filter('date')(date, 'HH:mm:ss');
|
||||||
|
}
|
||||||
|
|
||||||
|
formattedTime = formattedTime.replace(/ /g, " ");
|
||||||
|
// If in 12h time the hour field has only one number, zero pad it
|
||||||
|
formattedTime = formattedTime.replace(/^(\d)(:|\.)/, '0$1$2');
|
||||||
|
// Wrap the first time separator in a span
|
||||||
|
formattedTime = formattedTime.replace(/(:|\.)/, '<span class="cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters">$1</span>');
|
||||||
|
// Wrap the second time separator and seconds field in another span
|
||||||
|
// so that we can easily hide seconds using a CSS selector
|
||||||
|
formattedTime = formattedTime.replace(/(\d\d)(:|\.)(\d\d)/, '$1<span class="seconds"><span class="cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters">$2</span>$3</span>');
|
||||||
|
|
||||||
var prefix = parseRichText(message.prefix);
|
var prefix = parseRichText(message.prefix);
|
||||||
var tags_array = message.tags_array;
|
var tags_array = message.tags_array;
|
||||||
|
@ -370,6 +388,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
||||||
content: content,
|
content: content,
|
||||||
date: date,
|
date: date,
|
||||||
shortTime: shortTime,
|
shortTime: shortTime,
|
||||||
|
formattedTime: formattedTime,
|
||||||
buffer: buffer,
|
buffer: buffer,
|
||||||
tags: tags_array,
|
tags: tags_array,
|
||||||
highlight: highlight,
|
highlight: highlight,
|
||||||
|
|
Loading…
Reference in New Issue