Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
5e3a6a44
Commit
5e3a6a44
authored
Oct 04, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] there was a date format problem in mygraphs updating
parent
b5ff7a7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
nodes.py
gargantext/views/api/nodes.py
+1
-1
myGraphs.html
templates/pages/corpora/myGraphs.html
+33
-1
No files found.
gargantext/views/api/nodes.py
View file @
5e3a6a44
...
...
@@ -13,7 +13,7 @@ from collections import defaultdict
import
csv
_node_available_fields
=
[
'id'
,
'parent_id'
,
'name'
,
'typename'
,
'hyperdata'
,
'ngrams'
]
_node_available_fields
=
[
'id'
,
'parent_id'
,
'name'
,
'typename'
,
'hyperdata'
,
'ngrams'
,
'date'
]
_node_default_fields
=
[
'id'
,
'parent_id'
,
'name'
,
'typename'
]
_node_available_types
=
NODETYPES
...
...
templates/pages/corpora/myGraphs.html
View file @
5e3a6a44
...
...
@@ -132,12 +132,13 @@
return
false
}
// also replace template variables (thx c24b!)
resultHtml
=
resultHtml
.
replace
(
/%%project_id%%/g
,
projectId
);
resultHtml
=
resultHtml
.
replace
(
/%%corpus_id%%/g
,
corpusId
);
resultHtml
=
resultHtml
.
replace
(
/%%cooc_id%%/g
,
coocId
);
resultHtml
=
resultHtml
.
replace
(
/%%cooc_name%%/g
,
coocName
);
resultHtml
=
resultHtml
.
replace
(
/%%cooc_date%%/g
,
coocDate
);
resultHtml
=
resultHtml
.
replace
(
/%%cooc_date%%/g
,
formatDateLikeDjango
(
coocDate
)
);
if
(
typeof
nbEdges
!=
'undefined'
&&
typeof
nbNodes
!=
'undefined'
)
{
resultHtml
=
resultHtml
.
replace
(
/%%nb_nodes%%/g
,
nbNodes
);
...
...
@@ -291,6 +292,37 @@
clearTimeout
(
currentJob
)
}
// raw DB format: "2016-10-04T15:00:35Z" (ISOString)
// -----------------------
//
// but django default format: Oct. 4, 2016, 3:00 p.m.
// ------------------------
// cf. docs.djangoproject.com/en/dev/ref/settings/#date-format
//
// POSSIBLE: remove UTC from django and here (current timezone more practical)
function
formatDateLikeDjango
(
isoDateTimeStr
)
{
asDate
=
new
Date
(
isoDateTimeStr
)
// ex: "Oct 4, 2016"
var
newDateStr
=
asDate
.
toLocaleDateString
(
'en-US'
,
{
'year'
:
'numeric'
,
'month'
:
'short'
,
'day'
:
'numeric'
})
// ex: 3:00 pm
var
newTimeStr
=
asDate
.
toLocaleTimeString
(
'en-US'
,
{
'hour12'
:
true
,
'timeZone'
:
'UTC'
,
'hour'
:
'2-digit'
,
'minute'
:
'numeric'
})
.
toLowerCase
()
// ex Oct 4, 2016, 3:00 pm => close enough !
return
newDateStr
+
', '
+
newTimeStr
}
</script>
...
...
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