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
f530dd1b
Commit
f530dd1b
authored
Apr 25, 2016
by
Sean Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of "an hour ago" and "a day ago"
This produces "1 days ago" which is wrong, will be fixed later.
parent
cb3d2a2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
11 deletions
+2
-11
time-test.js
h/static/scripts/test/time-test.js
+2
-1
time.js
h/static/scripts/time.js
+0
-10
No files found.
h/static/scripts/test/time-test.js
View file @
f530dd1b
...
...
@@ -14,8 +14,9 @@ var FIXTURES_TO_FUZZY_STRING = [
[
49
,
'49 sec'
],
[
minute
+
5
,
'1 min'
],
[
3
*
minute
+
5
,
'3 min'
],
[
hour
,
'1 hr'
],
[
4
*
hour
,
'4 hr'
],
[
27
*
hour
,
'
a day
ago'
],
[
27
*
hour
,
'
1 days
ago'
],
[
3
*
day
+
30
*
minute
,
'3 days ago'
],
[
6
*
month
+
2
*
day
,
'6 months ago'
],
[
1
*
year
,
'one year ago'
],
...
...
h/static/scripts/time.js
View file @
f530dd1b
...
...
@@ -18,18 +18,10 @@ function lessThanOneHourAgo(date, now) {
return
((
now
-
date
)
<
(
60
*
60
*
1000
));
}
function
lessThanTwoHoursAgo
(
date
,
now
)
{
return
((
now
-
date
)
<
(
120
*
60
*
1000
));
}
function
lessThanOneDayAgo
(
date
,
now
)
{
return
((
now
-
date
)
<
(
24
*
60
*
60
*
1000
));
}
function
lessThanTwoDaysAgo
(
date
,
now
)
{
return
((
now
-
date
)
<
(
48
*
60
*
60
*
1000
));
}
function
lessThanThirtyDaysAgo
(
date
,
now
)
{
return
((
now
-
date
)
<
(
30
*
24
*
60
*
60
*
1000
));
}
...
...
@@ -78,9 +70,7 @@ var BREAKPOINTS = [
[
lessThanThirtySecondsAgo
,
function
()
{
return
'Just now'
;},
1
],
[
lessThanOneMinuteAgo
,
nSec
,
1
],
[
lessThanOneHourAgo
,
nMin
,
minute
],
[
lessThanTwoHoursAgo
,
function
()
{
return
'an hour ago'
;},
hour
],
[
lessThanOneDayAgo
,
nHr
,
hour
],
[
lessThanTwoDaysAgo
,
function
()
{
return
'a day ago'
;},
day
],
[
lessThanThirtyDaysAgo
,
nDaysAgo
,
day
],
[
lessThanOneYearAgo
,
nMonthsAgo
,
month
],
[
lessThanTwoYearsAgo
,
function
()
{
return
'one year ago'
;},
year
],
...
...
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