mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
feat: time display
This commit is contained in:
parent
ffeb65c2ec
commit
08cf4dd73c
@ -54,7 +54,7 @@ func (d *SqlDb) GetUserEvents(userID int, params db.RetrieveQueryParams) ([]db.E
|
||||
q := squirrel.Select("event.*, p.name as project_name").
|
||||
From("event").
|
||||
LeftJoin("project as p on event.project_id=p.id").
|
||||
OrderBy("created desc").
|
||||
OrderBy("id desc").
|
||||
LeftJoin("project__user as pu on pu.project_id=p.id").
|
||||
Where("p.id IS NULL or pu.user_id=?", userID)
|
||||
|
||||
@ -65,7 +65,7 @@ func (d *SqlDb) GetEvents(projectID int, params db.RetrieveQueryParams) ([]db.Ev
|
||||
q := squirrel.Select("event.*, p.name as project_name").
|
||||
From("event").
|
||||
LeftJoin("project as p on event.project_id=p.id").
|
||||
OrderBy("created desc").
|
||||
OrderBy("id desc").
|
||||
Where("event.project_id=?", projectID)
|
||||
|
||||
return d.getEvents(q, params)
|
||||
|
@ -128,7 +128,7 @@ func (d *SqlDb) getTasks(projectID int, templateID *int, taskIDs []int, params d
|
||||
From("task").
|
||||
Join("project__template as tpl on task.template_id=tpl.id").
|
||||
LeftJoin("`user` on task.user_id=`user`.id").
|
||||
OrderBy("task.created desc, id desc")
|
||||
OrderBy("id desc")
|
||||
|
||||
if templateID == nil {
|
||||
q = q.Where("tpl.project_id=?", projectID)
|
||||
|
@ -13,7 +13,18 @@ const convert = new Convert();
|
||||
axios.defaults.baseURL = document.baseURI;
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.filter('formatDate', (value) => (value ? moment(String(value)).fromNow() : '—'));
|
||||
Vue.filter('formatDate', (value) => {
|
||||
if (!value) {
|
||||
return '—';
|
||||
}
|
||||
const date = moment(value);
|
||||
const now = moment();
|
||||
|
||||
if (now.isSame(date, 'day')) {
|
||||
return `${date.fromNow()} (${date.format('LT')})`; // Display only time if today
|
||||
}
|
||||
return date.format('L LT'); // Display only date otherwise
|
||||
});
|
||||
Vue.filter('formatTime', (value) => (value ? moment(String(value)).format('LTS') : '—'));
|
||||
Vue.filter('formatLog', (value) => (value ? convert.toHtml(String(value)) : value));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user