Announcement

Collapse
No announcement yet.

datetime field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • datetime field

    Hi,
    in a separate entity we have two datetime fields "beginning" and "end". Users select the contents of the beginning field and must also select the day and time in the end field.
    Is it possible to organize that the day of the field end is the day of the field beginning.
    Also, it would be very good if you don't have to scroll from 0:00 at all times.
    peter

  • #2
    Hi,
    you can override tho view for your field "beginning", or you can add a field "duration" and "end" field will be calculated on the form, like in Meeting and Call entity?
    What is the name of your entity, and what way is good for you?

    Comment


    • #3
      Hi Tanya,
      Thanks for your suggestions.
      We have created our own modules in which we record times. I have already used the idea of calculating the end time using duration.
      The determination of the duration in the person works it ouit in his head miscalculations.
      The problem of scrolling from 00:00 to a time is complex in each module.
      peter

      Comment


      • #4
        Hi Peter,
        the easiest way is to set default in Entity Manager. It will set curent time as default an autoscroll to current time value.
        If you want to set in the file client/src/views/fields/datetime.js setDefaultTime - change the time value. (from 00:00 to 11:00 for example). You can change the view for all datetime field or only for needed.

        Comment


        • huscmk
          huscmk commented
          Editing a comment
          Hi,
          Is there a way to modify this function in an upgrade safe way ?

          Thanks

      • #5
        I've learned something new. Thank you very much Tanya

        Comment


        • #6
          Can you give me an example? :

          setDefaultTime: function () {
          var d = moment('2014-01-01 00:00').format(this.getDateTime().getDateTimeForma t()) || '';
          var index = d.indexOf(' ');
          if (~index) {
          this.$time.val(d.substr(index + 1));
          }
          },

          Comment


          • #7
            I tested with

            setDefaultTime: function () {
            var d = moment('2014-01-01 11:00').format(this.getDateTime().getDateTimeForma t()) || '';
            var index = d.indexOf(' ');
            if (~index) {
            this.$time.val(d.substr(index + 1));
            }
            },

            Comment


            • #8
              I changed the file. Scrolling starts at 00:00 am.

              Comment


              • #9
                After clear local cache, refreshing page and for new record without the default value?

                Comment


                • #10
                  've done everything. No success.

                  Comment


                  • #11
                    For me it works. Could you share more information about the field?
                    - the entity (if not custom)
                    - field Defs (/Resorses/enitityDefs/{EntityName}.json -> fields -> {field} content)

                    Comment


                    • #12
                      it works for Meetings. with your own entity it doesn't work

                      "anfang": {
                      "notNull": false,
                      "type": "datetime",
                      "required": false,
                      "isCustom": true,
                      "default": null,
                      "audited": false,
                      "readOnly": false,
                      "tooltip": false
                      },

                      Comment


                      • #13
                        it works for custom entity and custom field as well

                        Comment


                        • #14
                          I have looked again at the fields of the entity meetinmg. (see attachment) This is probably the reason why it works with this entity.
                          Unfortunately I can't insert this script into the other file types. There's a selection menu.

                          Comment


                          • #15
                            )) https://forum.espocrm.com/forum/general/25255-event

                            Originally posted by peterberlin View Post

                            "anfang": {
                            "notNull": false,
                            "type": "datetime",
                            "required": false,
                            "isCustom": true,
                            "default": null,
                            "audited": false,
                            "readOnly": false,
                            "tooltip": false
                            },
                            as you can see, you have the "default" option. Copy this row here
                            "default": "javascript: return this.dateTime.getNowMoment().hours(8).minutes(0).u tc().format(this.dateTime.internalDateTimeFormat); ",

                            The method I wrote before (client/src/views/fields/datetime.js setDefaultTime) is for all datetime field, which doesn't have the default value. This method (with default) affects only for this field.

                            Comment

                            Working...
                            X