Some tweaks to date formatting frontend

This commit is contained in:
nova 2020-02-13 18:25:57 +05:30
parent 8d313fa0e6
commit 4b4df5baf9
3 changed files with 7 additions and 3 deletions

View File

@ -152,7 +152,6 @@
<configuration>
<arguments>${gruntArg}</arguments>
</configuration>
<!-- <phase>package</phase> -->
</execution>
</executions>
</plugin>

View File

@ -79,10 +79,12 @@ Handlebars.registerHelper('avatar', function () {
return '<div class="img_cont_msg"> <img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img_msg"> </div>';
});
Handlebars.registerHelper('fromNow', function (date: string) {
if(date == null)
return ": Never"
return moment(date).fromNow();
})
Handlebars.registerHelper('msgDateFormat', function (date: string) {
return moment(date).calendar(moment.now(), {lastWeek: "DD/MM/YY hh:mm:a", sameElse: "DD/MM/YY hh:mm:a"})
return moment(date).calendar(moment.now(), { lastWeek: "DD/MM/YY hh:mm A", sameElse: "DD/MM/YY hh:mm A" })
})

View File

@ -76,6 +76,9 @@ export class UserModel implements Subject<ActiveUserViewModel> {
// log.trace(sessionStorage.getItem('activeUsers'));
log.info(`Subject: received ajax active users`);
data.map((d: any) => {
if( d.lastActive == null )
return null;
d.lastActive = new Date(d.lastActive)
return d;
});