Skip to content

Commit

Permalink
Update mapGenerator.js
Browse files Browse the repository at this point in the history
Gestion des dates en mode point
  • Loading branch information
geobrun authored May 16, 2024
1 parent 503c214 commit 755f2ad
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions atlas/static/mapGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,15 @@ function observersTxt(feature) {

// Popup Point
function onEachFeaturePoint(feature, layer) {
date = new Date(feature.properties.dateobs);
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
};
popupContent =
"<b>Date: </b>" +
feature.properties.dateobs +
date.toLocaleDateString(undefined, options) +
"</br><b>Altitude: </b>" +
feature.properties.altitude_retenue +
observersTxt(feature)
Expand Down Expand Up @@ -423,11 +429,17 @@ function displayMarkerLayerFicheEspece(
/* *** Point ****/

function onEachFeaturePointLastObs(feature, layer) {
date = new Date(feature.properties.dateobs);
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
};
popupContent =
"<b>Espèce: </b>" +
feature.properties.taxon +
"</br><b>Date: </b>" +
feature.properties.dateobs +
date.toLocaleDateString(undefined, options) +
"</br><b>Altitude: </b>" +
feature.properties.altitude_retenue;

Expand All @@ -444,11 +456,17 @@ function onEachFeaturePointLastObs(feature, layer) {
}

function onEachFeaturePointCommune(feature, layer) {
date = new Date(feature.properties.dateobs);
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
};
popupContent =
"<b>Espèce: </b>" +
feature.properties.taxon +
"</br><b>Date: </b>" +
feature.properties.dateobs +
date.toLocaleDateString(undefined, options) +
"</br><b>Altitude: </b>" +
feature.properties.altitude_retenue +
observersTxt(feature)
Expand Down

0 comments on commit 755f2ad

Please sign in to comment.