mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 16:06:15 +00:00
Format minutes & hour with prefixed zero
This commit is contained in:
parent
e800822c37
commit
4dde9f7e08
14
js/script.js
14
js/script.js
@ -33,6 +33,8 @@ function fetchConversation(phoneNumber) {
|
||||
var msgClass = '';
|
||||
var unixDate = '';
|
||||
var formatedDate = '';
|
||||
var formatedHour = '00';
|
||||
var formatedMin = '00';
|
||||
var months = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Aug.', 'Sep.',
|
||||
'Oct.', 'Nov.', 'Dec.'];
|
||||
|
||||
@ -49,8 +51,18 @@ function fetchConversation(phoneNumber) {
|
||||
|
||||
// Multiplicate ID to permit date to use it properly
|
||||
msgDate = new Date(id*1);
|
||||
|
||||
formatedHour = msgDate.getHours();
|
||||
if (formatedHour < 10) {
|
||||
formatedHour = '0' + formatedHour;
|
||||
}
|
||||
|
||||
formatedMin = msgDate.getMinutes();
|
||||
if (formatedMin < 10) {
|
||||
formatedMin = '0' + formatedMin;
|
||||
}
|
||||
formatedDate = msgDate.getDate() + " " + months[msgDate.getMonth()-1] + " " +
|
||||
msgDate.getHours() + ":" + msgDate.getMinutes();
|
||||
formatedHour + ":" + formatedMin;
|
||||
|
||||
conversationBuf += '<div><div class="' + msgClass + '"><div>' +
|
||||
vals["msg"] + '</div><div class="msg-date">' +
|
||||
|
Loading…
x
Reference in New Issue
Block a user