Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
44e42749
Commit
44e42749
authored
Jan 02, 2025
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: fix getRelativeTimeString for year
New year does not mean the period is 365 days.
parent
bd294aa6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_thread_reader_js.js
...mplateItem/web_page_module/rjs_gadget_thread_reader_js.js
+4
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_thread_reader_js.xml
...plateItem/web_page_module/rjs_gadget_thread_reader_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_thread_reader_js.js
View file @
44e42749
...
@@ -37,16 +37,15 @@
...
@@ -37,16 +37,15 @@
hour
=
minute
*
60
,
hour
=
minute
*
60
,
day
=
hour
*
24
,
day
=
hour
*
24
,
week
=
day
*
7
,
week
=
day
*
7
,
year
=
day
*
365
,
time_format
=
new
Intl
.
RelativeTimeFormat
(
language
);
time_format
=
new
Intl
.
RelativeTimeFormat
(
language
);
diff
=
date
.
getFullYear
()
-
current_date
.
getFullYear
();
if
(
diff
!==
0
)
{
return
time_format
.
format
(
diff
,
'
year
'
);
}
diff
=
date
-
current_date
;
diff
=
date
-
current_date
;
abs
=
Math
.
abs
(
diff
);
abs
=
Math
.
abs
(
diff
);
// "year", "quarter", "month", "week", "day", "hour", "minute", "second"
// "year", "quarter", "month", "week", "day", "hour", "minute", "second"
if
(
abs
>
year
)
{
return
time_format
.
format
(
Math
.
floor
(
diff
/
year
),
'
year
'
);
}
if
(
abs
>
(
week
*
2
))
{
if
(
abs
>
(
week
*
2
))
{
return
time_format
.
format
(
Math
.
floor
(
diff
/
week
),
'
week
'
);
return
time_format
.
format
(
Math
.
floor
(
diff
/
week
),
'
week
'
);
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_thread_reader_js.xml
View file @
44e42749
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1017.
21412.29767.13277
</string>
</value>
<value>
<string>
1017.
42673.18426.35652
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
17
18640624.19
</float>
<float>
17
35815864.25
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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