Date format: detect %e, too, and add some comments

This commit is contained in:
Lorenz Hübschle-Schneider 2016-09-19 09:35:52 +02:00
parent 02a3fbb876
commit e65804c7a7

View file

@ -77,11 +77,12 @@ weechat.factory('connection',
);
};
var _parseWeechatTimeFormat = function() {
// helper function to get a custom delimiter span
var _timeDelimiter = function(delim) {
return "'<span class=\"cof-chat_time_delimiters cob-chat_time_delimiters coa-chat_time_delimiters\">" + delim + "</span>'";
};
var _parseWeechatTimeFormat = function() {
// Fetch the buffer time format from weechat
var timeFormat = models.wconfig['weechat.look.buffer_time_format'];
@ -136,14 +137,18 @@ weechat.factory('connection',
angularFormat = short24;
}
if (timeFormat.indexOf("%d") > -1) {
// Check for day of month in time string
if (timeFormat.indexOf("%d") > -1 || timeFormat.indexOf("%e") > -1) {
angularFormat = "dd" + _timeDelimiter("&nbsp;") + angularFormat;
// month, too?
if (timeFormat.indexOf("%m") > -1) {
angularFormat = "MM" + _timeDelimiter("-") + angularFormat;
// year as well?
if (timeFormat.indexOf("%y") > -1) {
angularFormat = "yy" + _timeDelimiter("-") + angularFormat;
}
if (timeFormat.indexOf("%Y") > -1) {
} else if (timeFormat.indexOf("%Y") > -1) {
angularFormat = "yyyy" + _timeDelimiter("-") + angularFormat;
}
}