Dates hate me...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rudepeople
    Junior Member
    • May 2020
    • 17

    Dates hate me...

    We are struggling with dates now... I'm not entirely sure how much of these names translate, but here goes.
    Our users are complaining about the dates used in tasks. when they sort the tasks by "Date Due" the tasks sort, but the dates appear to be jumbled up a bit (they're not entirely in order.) we havent been able to figure out what is breaking the sorting. I can repliecate this by simply going to the tasks section and sorting by due date the dates are KINDOF in order, but not really.
    Additionally, the users don't really use the time portion of the dates when creating tasks and we're wanting to remove them.
    In the entity manager, when I go to the fields under "Tasks" I have several fields for dates pasted below:
    dateCompleted Date Completed Date-Time
    dateEnd Date Due Date/Date-Time
    dateEndDate Date End (all day) Date
    dateStart Date Start Date/Date-Time
    dateStartDate Date Start (All Day) Date
    Date Completed is fine (except we don't want to have to put in time), and "Date End (all day)" and "Date Start (all day)" seem to be the fields we want to use... however when I go to layout, neither are options?
    the only thing we can see that's really diferent between the date fields is the data types being "Date-Time", Data/Date-Time", and "Date". Additionally, "Date End (all day)" and "Date Start (all day)" don't have dynamic logic... how can I enable the use of the "(all day)" fields in tasks, or how do I remove the time portion of the Date Due and Date Start fields. and second, how do I fix the sorting problem? are they connected?
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    I've tested the sorting with the "Date Due" field and everything works good.

    1. The 'Date End (all day)' and 'Date Start (All Day)' fields are the system fields and they are not available for the layout.
    2. The 'Date Completed' field is a read-only field on your layout that becomes to be shown if you will set the 'Status' field to 'Completed'. This field shows date and time when you set Status -> Completed.
    3. Removing the time portion of the Date Due and Date Start fields is not necessary. It is enough to disable after/before checking to be able to set it w/o time part. Here is the way I found:
    3.1. Create or edit the file: /custom/Espo/Custom/Resources/metadata/entityDefs/Task.json;
    3.2. Add this code to the 'fields' scope:
    Code:
    {
        "fields": {
    [COLOR=#c0392b]       "dateStart": {
                "before": ""
            },
            "dateEnd": {
                "after": ""
            },[/COLOR]
           .....
    }
    3.3. Administration -> Clear Cache;
    3.4. Refresh a web page.

    Note. This changes might affect some another functionality that depends on these conditions.
    Last edited by Maximus; 06-26-2020, 12:07 PM.

    Comment

    • rudepeople
      Junior Member
      • May 2020
      • 17

      #3
      Originally posted by Maximus
      Hi,
      I've tested the sorting with the "Date Due" field and everything works good.
      honestly, I'm not even sure what could be the issue. the only thing I can find is in poking around in the database I found there are 5 fields: date_start, date_end, date_start_date, date_end_date, and date_completed. these fields correspond with the date stamps listed above (I set a few arbitrarily on a record to see what changed in the tasks). in the list view, tasks sorted by due date are occasionally out of order. MOST are in order, but a few just appear in random places. when I look at the date_end and date_end_date fields for those records in the db, I see their date stamps dont match up from one field to the other, but when I sort the table by date_end_date. the sorting order matches what we see in espo. so that indicates espo is sorting the list view by date_end_date and not date_end. as you pointed out, we cant edit date_end_date.

      I guess I'm just going to have to go through the database and edit those fields to make the dates line up, but that's a pretty inelegant solution. is there maybe a better option? is it possible to tell espo to sort by the date_end instead of date_end_date?


      Originally posted by Maximus
      It is enough to disable after/before checking to be able to set it w/o time part. Here is the way I found:...
      that seems to have worked for the time stamp complaint. thanks!


      Comment

      Working...