datetime field

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • huscmk
    commented on 's reply
    Hi,
    Is there a way to modify this function in an upgrade safe way ?

    Thanks

  • tanya
    replied
    )) https://forum.espocrm.com/forum/general/25255-event

    Originally posted by peterberlin

    "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.

    Leave a comment:


  • peterberlin
    replied
    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.

    Leave a comment:


  • tanya
    replied
    it works for custom entity and custom field as well

    Leave a comment:


  • peterberlin
    replied
    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
    },

    Leave a comment:


  • tanya
    replied
    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)

    Leave a comment:


  • peterberlin
    replied
    've done everything. No success.

    Leave a comment:


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

    Leave a comment:


  • peterberlin
    replied
    I changed the file. Scrolling starts at 00:00 am.

    Leave a comment:


  • tanya
    replied
    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));
    }
    },

    Leave a comment:


  • peterberlin
    replied
    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));
    }
    },

    Leave a comment:


  • peterberlin
    replied
    I've learned something new. Thank you very much Tanya

    Leave a comment:


  • tanya
    replied
    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.

    Leave a comment:


  • peterberlin
    replied
    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

    Leave a comment:


  • tanya
    replied
    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?

    Leave a comment:

Working...