Skip to content

Instantly share code, notes, and snippets.

@GiselaMD
Last active May 28, 2018 12:33
Show Gist options
  • Save GiselaMD/0cc245247f65af2398178c7a730b041c to your computer and use it in GitHub Desktop.
Save GiselaMD/0cc245247f65af2398178c7a730b041c to your computer and use it in GitHub Desktop.
Broken Window Theory - Date
<ion-item *ngIf="message.from !== username" class="messageNotUser" [ngClass]="{'my_message': message.from === username, 'other_message': message.from !== username}">
<span class="user_name">{{ message.from }}:</span><br>
<span>{{ message.text }}</span>
<div class="time">Lançado dia: {{message.created | date:'dd.MM hh:MM'}}</div>
</ion-item>
addTodo() {
var d = new Date();
var horas = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
var mm = d.getMonth() + 1;
var dd = d.getDate();
var yy = d.getFullYear();
var myDateString = 'Lançado dia: '+ dd + '/' + mm + '/' + yy + ' às ' + horas +':'+ minutes +':'+ seconds;
if (this.comment !== '') {
this.todos.push(myDateString);
this.todos.push(" + Comentário: "+ '\" ' + this.comment + ' \"');
// Reset the variable of the input field
this.comment = '';
}else{
this.todos.push(myDateString);
}
}
socket.on('add-message', (message) => {
io.emit('message', {text: message.text, from: socket.username, created: new Date()});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment