How formatting date fields on attribute table?

94 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

Pedro Garcia

unread,
Mar 13, 2023, 9:36:22 AM3/13/23
to mapstore-users
Hi all,
Values displayed for date fields are not displayed in an understandable way for users, as you can see in attached image. Is there any way to format date fields displayed on attribute table as is showed on postgres?
Thanks.

borrar.png

Pedro Garcia

unread,
Mar 14, 2023, 4:30:43 AM3/14/23
to mapstore-users
I have found this solution:
It's neccesary to start Geoserver with this Java option:
-Dorg.geotools.localDateTimeHandling=true

Lorenzo Natali

unread,
Mar 14, 2023, 6:38:55 AM3/14/23
to mapstore-users
Hi,
MapStore shows the date-time data in standard ISO format, that is the one handled by GeoServer. To have a different formatting, you can configure the FeatureEditor plugin to use your local format for date and time.



therefore in "localConfig.json" file, replace plugins --> desktop --> "FeatureEditor" string with an object like this : 
{
 "name": "FeatureEditor",
 "cfg": {
"dateFormats": {
   "date-time": "MM DD YYYY - HH:mm:ss",
   "date": "MM DD YYYY",
   "time": "HH:mm:ss"
}

GB RL

unread,
Oct 25, 2023, 9:24:51 AM10/25/23
to mapstore-users
Hi,
I follow the last comment, but this doesn't works (bad config i guess ?).

Here my (classic) use case 

1. Save data in postgis with 1 DATE field (PG_FIELDS picture)
2. Publish data with GeoServer (see detected fields in GS_FIELDS picture)
3. Create a MapStore2 contexte, and add this FeatureEditor config

    "cfg": {
        "dateFormats": {
            "date-time": "MM DD YYYY - HH:mm:ss",
            "date": "MM DD YYYY",
            "time": "HH:mm:ss"
        }
    },

4. See that fields are not formated (ms_fields picture)

Could you confirm that dateFormats allow to change date display in attribute table ?

Thanks.

GB


ms_fields.JPG
GS_FIELDS.JPG
PG_FIELDS.JPG

GB RL

unread,
Nov 6, 2023, 5:17:34 AM11/6/23
to mapstore-users
Hi,
Does anyone have a working example of this ?

gaetan....@gmail.com

unread,
Jan 10, 2024, 4:47:15 AMJan 10
to mapstore-users
Hi,
Datetime format config works fine with MapStore2 2023.02.xx .

Here, configs, data and definitions used :
  • PostgreSql fields definitions 
temp_date3.JPG

  • Datetime format render without FeatureEditor dateFormats config
temp_date0.JPG
  • Datetime format render with  FeatureEditor dateFormats config
temp_date1.JPG
  • GeoServer columns
temp_date2.JPG
  • localConfig.json use
              "cfg": {
                "dateFormats": {
                  "date-time": "MM DD YYYY - HH:mm:ss",
                  "date": "MM DD YYYY",
                  "time": "HH:mm:ss"
              },


I hope this message will be useful to others.

Gaëtan B
Jdev
======

Simone Giannecchini

unread,
Jan 10, 2024, 8:40:18 AMJan 10
to mapstor...@googlegroups.com
Hi Gaetan,
thanks for taking the time to provide this information.

Regards,
Simone Giannecchini
==
Online training classes for GeoNode, GeoServer and MapStore from the experts!
Visit https://www.geosolutionsgroup.com/professional-training/ for more information.
==
Ing. Simone Giannecchini
@simogeo
Founder/Director GeoSolutions Italy
President GeoSolutions USA


http://www.geosolutionsgroup.com
http://twitter.com/geosolutions_it

-------------------------------------------------------
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.


--
You received this message because you are subscribed to the Google Groups "mapstore-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstore-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapstore-users/fe7233e0-7e96-462e-bacd-fbc6c873ead8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages