TimeZone of a particular DateTime field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aldisa
    Junior Member
    • Jun 2023
    • 28

    TimeZone of a particular DateTime field

    Here is the context of the problem.

    The CRM User is a company employee, who is located in (for example) the "America/New York" or EST timezone.

    The company uses the CRM to manage jobs performed for customers. Customers can be located anywhere, so in different timezones.

    On the Job Detail view, we show a custom DateTime field called "Scheduled Start Time".

    Let us say that the customer is located in "America/Chicago" or CST timezone.
    It is confusing for the User if this field is displayed in the User's Timezone (EST) or in UTC.
    In this example, the field show both show the values and allow input of the values in CST.

    In other words, we need to be able to dynamically select the timezone of custom DateTime fields in the UI. All DateTime values are stored in the backend in UTC.

    How can this be done, so that both the display and the input/update of a DateTime field is done in a dynamically specified timezone?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1608

    #2
    I guess you have any field, which tells the actual timezone of your employee. Then you can create a datetime field and process the actual local time according to that timezone by formula as described here: https://docs.espocrm.com/administrat...datetimeformat

    Comment

    • yuri
      Member
      • Mar 2014
      • 8458

      #3
      You need to create a custom field view with date-time picker. The current datetime view converts values to UTC and UTC is sent to the backend. There's no designed way to suppress conversion.

      Option 1. Your field does not do conversion. You convert to UTC in the backend.
      Option 2. Your field does conversion according selected timezone and sends UTC to the backend.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...