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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
7bd0bac2
Commit
7bd0bac2
authored
Dec 31, 2019
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! erp5_web_renderjs_ui: datetime field formats date in the interface language
parent
d1f19c42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_datetimefield_js.js
...eItem/web_page_module/rjs_gadget_erp5_datetimefield_js.js
+22
-8
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_datetimefield_js.xml
...Item/web_page_module/rjs_gadget_erp5_datetimefield_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_datetimefield_js.js
View file @
7bd0bac2
...
@@ -238,16 +238,33 @@
...
@@ -238,16 +238,33 @@
gadget_list
=
result_list
[
1
],
gadget_list
=
result_list
[
1
],
text_content
=
""
,
text_content
=
""
,
state_date
,
state_date
,
locale_formatted_state_date
,
offset_time_zone
;
offset_time_zone
;
if
(
gadget
.
state
.
value
)
{
if
(
gadget
.
state
.
value
)
{
state_date
=
new
Date
(
gadget
.
state
.
value
);
state_date
=
new
Date
(
gadget
.
state
.
value
);
/* Ideally we would like to use {timeStyle: "short"} as option
* to hide seconds. Unfortunately it doesn't work in older
* versions of firefox. Luckily, by using
* {hour: "numeric", minute: "numeric"}
* it hides seconds, and still respects the locale.
* >> date = new Date(2019, 1, 1, 1, 1)
* >> date.toLocaleTimeString(
* 'en', {hour: "numeric", minute: "numeric"}
* )
* "1:01 AM"
* >> date.toLocaleTimeString(
* 'fr', {hour: "numeric", minute: "numeric"}
* )
* "01:01"
*/
locale_formatted_state_date
=
state_date
.
toLocaleTimeString
(
language
,
{
hour
:
"
numeric
"
,
minute
:
"
numeric
"
}
);
if
(
gadget
.
state
.
timezone_style
)
{
if
(
gadget
.
state
.
timezone_style
)
{
text_content
=
state_date
.
toLocaleDateString
(
language
);
text_content
=
state_date
.
toLocaleDateString
(
language
);
if
(
!
gadget
.
state
.
date_only
)
{
if
(
!
gadget
.
state
.
date_only
)
{
text_content
+=
"
"
+
state_date
.
toLocaleTimeString
(
text_content
+=
"
"
+
locale_formatted_state_date
;
language
,
{
timeStyle
:
"
short
"
}
);
}
}
}
else
{
}
else
{
//get timezone difference between server and local browser
//get timezone difference between server and local browser
...
@@ -256,10 +273,7 @@
...
@@ -256,10 +273,7 @@
state_date
.
setUTCHours
(
state_date
.
getUTCHours
()
+
offset_time_zone
);
state_date
.
setUTCHours
(
state_date
.
getUTCHours
()
+
offset_time_zone
);
text_content
=
state_date
.
toLocaleDateString
(
language
);
text_content
=
state_date
.
toLocaleDateString
(
language
);
if
(
!
gadget
.
state
.
date_only
)
{
if
(
!
gadget
.
state
.
date_only
)
{
text_content
+=
"
"
+
state_date
.
toLocaleTimeString
(
text_content
+=
"
"
+
locale_formatted_state_date
;
language
,
{
timeStyle
:
"
short
"
}
);
}
}
}
}
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_datetimefield_js.xml
View file @
7bd0bac2
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
980.
48184.20620.63641
</string>
</value>
<value>
<string>
980.
55051.50282.19404
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15777
60705.94
</float>
<float>
15777
75957.85
</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