forked from Sanders/TelegaBot
feat: Add read date display in formatBookEntry
This commit is contained in:
@@ -9,11 +9,12 @@ public class BookFormatUtils {
|
|||||||
String prefix = forEdit ?
|
String prefix = forEdit ?
|
||||||
String.valueOf((char) ('0' + index + 1)) + "\uFE0F\u20E3 " : "";
|
String.valueOf((char) ('0' + index + 1)) + "\uFE0F\u20E3 " : "";
|
||||||
|
|
||||||
return String.format("%s%s *%s*\n✍️ _%s_\n🏆 %s\n▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n",
|
return String.format("%s%s *%s*\n✍️ _%s_\n📅 %s\n🏆 %s\n▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n",
|
||||||
prefix,
|
prefix,
|
||||||
getBookIcon(index),
|
getBookIcon(index),
|
||||||
escapeMarkdown(book.getTitle()),
|
escapeMarkdown(book.getTitle()),
|
||||||
escapeMarkdown(book.getAuthor()),
|
escapeMarkdown(book.getAuthor()),
|
||||||
|
formatDate(book.getReadDate()),
|
||||||
escapeMarkdown(formatRating(book.getRating())));
|
escapeMarkdown(formatRating(book.getRating())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +26,13 @@ public class BookFormatUtils {
|
|||||||
return text.replaceAll("([_*\\[\\]()~`>#+=|{}.!-])", "\\\\$1");
|
return text.replaceAll("([_*\\[\\]()~`>#+=|{}.!-])", "\\\\$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatDate(Date date) {
|
||||||
|
if (date == null) {
|
||||||
|
return "Не указана";
|
||||||
|
}
|
||||||
|
return new SimpleDateFormat("dd.MM.yyyy").format(date);
|
||||||
|
}
|
||||||
|
|
||||||
public static String formatRating(int rating) {
|
public static String formatRating(int rating) {
|
||||||
int validatedRating = Math.min(MAX_RATING, Math.max(MIN_RATING, rating));
|
int validatedRating = Math.min(MAX_RATING, Math.max(MIN_RATING, rating));
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user