<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "Good morning! How are you today?",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "I'm doing well, thanks for asking!",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 2, 10, 30)
},
{
id: 3,
text: "Did you see the news today?",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 5, 14, 15)
}
];
$("#chat").kendoChat({
timestampTemplate: function(data) {
const date = data.date;
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
return "<div class='custom-timestamp'>" +
"<span class='timestamp-text'>" +
dayNames[date.getDay()] + ", " +
monthNames[date.getMonth()] + " " +
date.getDate() +
"</span>" +
"</div>";
},
authorId: "user2",
dataSource: messagesData
});
</script>