Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
49f05dfa
Commit
49f05dfa
authored
12 years ago
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #402 from zimba12/master
Uncomment hours entries in relative date functions
parents
e06513d7
7d01342b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/js/js.js
+7
-6
7 additions, 6 deletions
core/js/js.js
lib/template.php
+3
-3
3 additions, 3 deletions
lib/template.php
with
10 additions
and
9 deletions
core/js/js.js
+
7
−
6
View file @
49f05dfa
...
...
@@ -641,7 +641,7 @@ if (!Array.prototype.map){
/**
* Filter Jquery selector by attribute value
*
*/
*/
$
.
fn
.
filterAttr
=
function
(
attr_name
,
attr_value
)
{
return
this
.
filter
(
function
()
{
return
$
(
this
).
attr
(
attr_name
)
===
attr_value
;
});
};
...
...
@@ -675,7 +675,8 @@ function formatDate(date){
return
$
.
datepicker
.
formatDate
(
datepickerFormatDate
,
date
)
+
'
'
+
date
.
getHours
()
+
'
:
'
+
((
date
.
getMinutes
()
<
10
)?
'
0
'
:
''
)
+
date
.
getMinutes
();
}
/* takes an absolute timestamp and return a string with a human-friendly relative date
/**
* takes an absolute timestamp and return a string with a human-friendly relative date
* @param int a Unix timestamp
*/
function
relative_modified_date
(
timestamp
)
{
...
...
@@ -687,14 +688,14 @@ function relative_modified_date(timestamp) {
if
(
timediff
<
60
)
{
return
t
(
'
core
'
,
'
seconds ago
'
);
}
else
if
(
timediff
<
120
)
{
return
t
(
'
core
'
,
'
1 minute ago
'
);
}
else
if
(
timediff
<
3600
)
{
return
t
(
'
core
'
,
'
{minutes} minutes ago
'
,{
minutes
:
diffminutes
});
}
//
else if(
$
timediff < 7200) { return '1 hour ago'; }
//
else if(
$
timediff < 86400) { return
$diff
hours
.'
hours ago'; }
else
if
(
timediff
<
7200
)
{
return
t
(
'
core
'
,
'
1 hour ago
'
)
;
}
else
if
(
timediff
<
86400
)
{
return
t
(
'
core
'
,
'
{
hours
}
hours ago
'
,{
hours
:
diffhours
})
;
}
else
if
(
timediff
<
86400
)
{
return
t
(
'
core
'
,
'
today
'
);
}
else
if
(
timediff
<
172800
)
{
return
t
(
'
core
'
,
'
yesterday
'
);
}
else
if
(
timediff
<
2678400
)
{
return
t
(
'
core
'
,
'
{days} days ago
'
,{
days
:
diffdays
});
}
else
if
(
timediff
<
5184000
)
{
return
t
(
'
core
'
,
'
last month
'
);
}
//
else if(
$
timediff < 31556926) { return
$diff
months
.'
months ago'; }
else
if
(
timediff
<
31556926
)
{
return
t
(
'
core
'
,
'
months ago
'
);
}
else
if
(
timediff
<
31556926
)
{
return
t
(
'
core
'
,
'
{
months
}
months ago
'
,{
months
:
diffmonths
})
;
}
//
else if(timediff < 31556926) { return t('core','months ago'); }
else
if
(
timediff
<
63113852
)
{
return
t
(
'
core
'
,
'
last year
'
);
}
else
{
return
t
(
'
core
'
,
'
years ago
'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/template.php
+
3
−
3
View file @
49f05dfa
...
...
@@ -103,13 +103,13 @@ function relative_modified_date($timestamp) {
if
(
$timediff
<
60
)
{
return
$l
->
t
(
'seconds ago'
);
}
else
if
(
$timediff
<
120
)
{
return
$l
->
t
(
'1 minute ago'
);
}
else
if
(
$timediff
<
3600
)
{
return
$l
->
t
(
'%d minutes ago'
,
$diffminutes
);
}
//
else if($timediff < 7200) { return '1 hour ago'; }
//
else if($timediff < 86400) { return $
diffhours.' hours ago'
; }
else
if
(
$timediff
<
7200
)
{
return
$l
->
t
(
'1 hour ago'
)
;
}
else
if
(
$timediff
<
86400
)
{
return
$
l
->
t
(
'%d hours ago'
,
$diffhours
)
;
}
else
if
((
date
(
'G'
)
-
$diffhours
)
>
0
)
{
return
$l
->
t
(
'today'
);
}
else
if
((
date
(
'G'
)
-
$diffhours
)
>
-
24
)
{
return
$l
->
t
(
'yesterday'
);
}
else
if
(
$timediff
<
2678400
)
{
return
$l
->
t
(
'%d days ago'
,
$diffdays
);
}
else
if
(
$timediff
<
5184000
)
{
return
$l
->
t
(
'last month'
);
}
else
if
((
date
(
'n'
)
-
$diffmonths
)
>
0
)
{
return
$l
->
t
(
'months ago'
);
}
else
if
((
date
(
'n'
)
-
$diffmonths
)
>
0
)
{
return
$l
->
t
(
'
%d
months ago'
,
$diffmonths
);
}
else
if
(
$timediff
<
63113852
)
{
return
$l
->
t
(
'last year'
);
}
else
{
return
$l
->
t
(
'years ago'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment