Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
5face40b
Commit
5face40b
authored
Apr 25, 2016
by
Sean Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace "n hours ago" with "n hr"
parent
fad6d7f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
time-test.js
h/static/scripts/test/time-test.js
+1
-1
time.js
h/static/scripts/time.js
+3
-3
No files found.
h/static/scripts/test/time-test.js
View file @
5face40b
...
...
@@ -14,7 +14,7 @@ var FIXTURES_TO_FUZZY_STRING = [
[
49
,
'49 sec'
],
[
minute
+
5
,
'a minute ago'
],
[
3
*
minute
+
5
,
'3 min'
],
[
4
*
hour
,
'4 h
ours ago
'
],
[
4
*
hour
,
'4 h
r
'
],
[
27
*
hour
,
'a day ago'
],
[
3
*
day
+
30
*
minute
,
'3 days ago'
],
[
6
*
month
+
2
*
day
,
'6 months ago'
],
...
...
h/static/scripts/time.js
View file @
5face40b
...
...
@@ -62,8 +62,8 @@ function nMin(date, now) {
return
'{} min'
.
replace
(
'{}'
,
Math
.
floor
(
delta
(
date
,
now
)
/
minute
));
}
function
nH
oursAgo
(
date
,
now
)
{
return
'{} h
ours ago
'
.
replace
(
'{}'
,
Math
.
floor
(
delta
(
date
,
now
)
/
hour
));
function
nH
r
(
date
,
now
)
{
return
'{} h
r
'
.
replace
(
'{}'
,
Math
.
floor
(
delta
(
date
,
now
)
/
hour
));
}
function
nDaysAgo
(
date
,
now
)
{
...
...
@@ -84,7 +84,7 @@ var BREAKPOINTS = [
[
lessThanTwoMinutesAgo
,
function
()
{
return
'a minute ago'
;},
minute
],
[
lessThanOneHourAgo
,
nMin
,
minute
],
[
lessThanTwoHoursAgo
,
function
()
{
return
'an hour ago'
;},
hour
],
[
lessThanOneDayAgo
,
nH
oursAgo
,
hour
],
[
lessThanOneDayAgo
,
nH
r
,
hour
],
[
lessThanTwoDaysAgo
,
function
()
{
return
'a day ago'
;},
day
],
[
lessThanThirtyDaysAgo
,
nDaysAgo
,
day
],
[
lessThanOneYearAgo
,
nMonthsAgo
,
month
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment