Fossil SCM
For the chat function, the server-to-client JSON uses strict ISO8601 time strings, including the "T" in the middle and the "Z" at the end.
Commit
13c95f0c7537746cf7d7b1a2226d86c2b1ee136c20615c801f0d309f2264a117
Parent
6506b6de437636a…
2 files changed
+2
-1
+2
-2
+2
-1
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -457,11 +457,12 @@ | ||
| 457 | 457 | int iToDel = db_column_int(&q1, 7); |
| 458 | 458 | char *zMsg; |
| 459 | 459 | if(cnt++){ |
| 460 | 460 | blob_append(&json, ",\n", 2); |
| 461 | 461 | } |
| 462 | - blob_appendf(&json, "{\"msgid\":%d,\"mtime\":%!j,", id, zDate); | |
| 462 | + blob_appendf(&json, "{\"msgid\":%d,", id); | |
| 463 | + blob_appendf(&json, "\"mtime\":\"%.10sT%sZ\",", zDate, zDate+11); | |
| 463 | 464 | blob_appendf(&json, "\"xfrom\":%!j,", zFrom); |
| 464 | 465 | blob_appendf(&json, "\"uclr\":%!j,", hash_color(zFrom)); |
| 465 | 466 | |
| 466 | 467 | zMsg = chat_format_to_html(zRawMsg ? zRawMsg : ""); |
| 467 | 468 | blob_appendf(&json, "\"xmsg\":%!j,", zMsg); |
| 468 | 469 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -457,11 +457,12 @@ | |
| 457 | int iToDel = db_column_int(&q1, 7); |
| 458 | char *zMsg; |
| 459 | if(cnt++){ |
| 460 | blob_append(&json, ",\n", 2); |
| 461 | } |
| 462 | blob_appendf(&json, "{\"msgid\":%d,\"mtime\":%!j,", id, zDate); |
| 463 | blob_appendf(&json, "\"xfrom\":%!j,", zFrom); |
| 464 | blob_appendf(&json, "\"uclr\":%!j,", hash_color(zFrom)); |
| 465 | |
| 466 | zMsg = chat_format_to_html(zRawMsg ? zRawMsg : ""); |
| 467 | blob_appendf(&json, "\"xmsg\":%!j,", zMsg); |
| 468 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -457,11 +457,12 @@ | |
| 457 | int iToDel = db_column_int(&q1, 7); |
| 458 | char *zMsg; |
| 459 | if(cnt++){ |
| 460 | blob_append(&json, ",\n", 2); |
| 461 | } |
| 462 | blob_appendf(&json, "{\"msgid\":%d,", id); |
| 463 | blob_appendf(&json, "\"mtime\":\"%.10sT%sZ\",", zDate, zDate+11); |
| 464 | blob_appendf(&json, "\"xfrom\":%!j,", zFrom); |
| 465 | blob_appendf(&json, "\"uclr\":%!j,", hash_color(zFrom)); |
| 466 | |
| 467 | zMsg = chat_format_to_html(zRawMsg ? zRawMsg : ""); |
| 468 | blob_appendf(&json, "\"xmsg\":%!j,", zMsg); |
| 469 |
+2
-2
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -376,11 +376,11 @@ | ||
| 376 | 376 | cssClass: ['fossil-tooltip', 'chat-message-popup'], |
| 377 | 377 | refresh:function(){ |
| 378 | 378 | const eMsg = this._eMsg; |
| 379 | 379 | if(!eMsg) return; |
| 380 | 380 | D.clearElement(this.e); |
| 381 | - const d = new Date(eMsg.dataset.timestamp+"Z"); | |
| 381 | + const d = new Date(eMsg.dataset.timestamp); | |
| 382 | 382 | if(d.getMinutes().toString()!=="NaN"){ |
| 383 | 383 | // Date works, render informative timestamps |
| 384 | 384 | D.append(this.e, |
| 385 | 385 | D.append(D.span(), localTimeString(d)," client-local"), |
| 386 | 386 | D.append(D.span(), iso8601ish(d))); |
| @@ -607,11 +607,11 @@ | ||
| 607 | 607 | eWho.setAttribute('align', 'left'); |
| 608 | 608 | } |
| 609 | 609 | eWho.style.backgroundColor = m.uclr; |
| 610 | 610 | eWho.classList.add('message-user'); |
| 611 | 611 | let whoName = m.xfrom; |
| 612 | - var d = new Date(m.mtime + "Z"); | |
| 612 | + var d = new Date(m.mtime); | |
| 613 | 613 | if( d.getMinutes().toString()!="NaN" ){ |
| 614 | 614 | /* Show local time when we can compute it */ |
| 615 | 615 | eWho.append(D.text(whoName+' @ '+ |
| 616 | 616 | d.getHours()+":"+(d.getMinutes()+100).toString().slice(1,3) |
| 617 | 617 | )) |
| 618 | 618 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -376,11 +376,11 @@ | |
| 376 | cssClass: ['fossil-tooltip', 'chat-message-popup'], |
| 377 | refresh:function(){ |
| 378 | const eMsg = this._eMsg; |
| 379 | if(!eMsg) return; |
| 380 | D.clearElement(this.e); |
| 381 | const d = new Date(eMsg.dataset.timestamp+"Z"); |
| 382 | if(d.getMinutes().toString()!=="NaN"){ |
| 383 | // Date works, render informative timestamps |
| 384 | D.append(this.e, |
| 385 | D.append(D.span(), localTimeString(d)," client-local"), |
| 386 | D.append(D.span(), iso8601ish(d))); |
| @@ -607,11 +607,11 @@ | |
| 607 | eWho.setAttribute('align', 'left'); |
| 608 | } |
| 609 | eWho.style.backgroundColor = m.uclr; |
| 610 | eWho.classList.add('message-user'); |
| 611 | let whoName = m.xfrom; |
| 612 | var d = new Date(m.mtime + "Z"); |
| 613 | if( d.getMinutes().toString()!="NaN" ){ |
| 614 | /* Show local time when we can compute it */ |
| 615 | eWho.append(D.text(whoName+' @ '+ |
| 616 | d.getHours()+":"+(d.getMinutes()+100).toString().slice(1,3) |
| 617 | )) |
| 618 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -376,11 +376,11 @@ | |
| 376 | cssClass: ['fossil-tooltip', 'chat-message-popup'], |
| 377 | refresh:function(){ |
| 378 | const eMsg = this._eMsg; |
| 379 | if(!eMsg) return; |
| 380 | D.clearElement(this.e); |
| 381 | const d = new Date(eMsg.dataset.timestamp); |
| 382 | if(d.getMinutes().toString()!=="NaN"){ |
| 383 | // Date works, render informative timestamps |
| 384 | D.append(this.e, |
| 385 | D.append(D.span(), localTimeString(d)," client-local"), |
| 386 | D.append(D.span(), iso8601ish(d))); |
| @@ -607,11 +607,11 @@ | |
| 607 | eWho.setAttribute('align', 'left'); |
| 608 | } |
| 609 | eWho.style.backgroundColor = m.uclr; |
| 610 | eWho.classList.add('message-user'); |
| 611 | let whoName = m.xfrom; |
| 612 | var d = new Date(m.mtime); |
| 613 | if( d.getMinutes().toString()!="NaN" ){ |
| 614 | /* Show local time when we can compute it */ |
| 615 | eWho.append(D.text(whoName+' @ '+ |
| 616 | d.getHours()+":"+(d.getMinutes()+100).toString().slice(1,3) |
| 617 | )) |
| 618 |