Skip to content
Snippets Groups Projects
Commit ee29ef9a authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Automatically use the user’s locale for time and date formatting

parent 458f5976
Branches
No related tags found
No related merge requests found
......@@ -220,12 +220,12 @@
border-bottom: none
time
width: 128px
width: 136px
display: inline-block
text-align: right
flex-shrink: 0
font-family: monospace
font-size: 90%
font-size: 85%
color: #444
@media(max-width: 800px)
......
......@@ -753,12 +753,12 @@ body {
}
.results .buffer .container .context .message time {
width: 128px;
width: 136px;
display: inline-block;
text-align: right;
flex-shrink: 0;
font-family: monospace;
font-size: 90%;
font-size: 85%;
color: #444;
}
......
......@@ -83,5 +83,6 @@ class App {
}
}
moment.locale(navigator.languages || navigator.language);
const app = new App();
document.body.insertBefore(app.elem, document.body.firstChild);
\ No newline at end of file
......@@ -12,7 +12,7 @@ class Message {
$$a.setAttribute('class', 'message');
var $$b = document.createElement('time');
$$a.appendChild($$b);
$$b.appendChildren(new Date(this.time.replace(' ', 'T') + 'Z').toUTCString());
$$b.appendChildren(moment(new Date(this.time.replace(' ', 'T') + 'Z')).format('L LT'));
var $$d = document.createElement('div');
$$d.setAttribute('class', 'container');
$$a.appendChild($$d);
......
......@@ -11,7 +11,7 @@ class Message {
render() {
return this.elem = (
<div className="message">
<time>{new Date(this.time.replace(" ", "T") + "Z").toUTCString()}</time>
<time>{moment(new Date(this.time.replace(" ", "T") + "Z")).format('L LT')}</time>
<div className="container">
<div className="sender" data-sendercolor={SenderColorHandler.nickToColor(this.getNick())}>
{this.getNick()}
......
This diff is collapsed.
......@@ -19,6 +19,7 @@
<script>
const translation = <?php echo json_encode($translation); ?>;
</script>
<script src="res/js/util/moment-with-locales.js"></script>
<script src="res/js/util/nativejsx-prototypes.js"></script>
<script src="res/js/util/loader.js"></script>
<script src="res/js/util/component.js"></script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment