{timestamp} not working in IE

Forums Dynamic Forms for SharePoint {timestamp} not working in IE

Viewing 15 reply threads
  • Author
    Posts
    • #30015
      Paul Lynch
      Participant

      Hi Alex,

      Everything is working great with the latest form in Chrome.

      Unfortunately some stubborn users continue to use the unsupported IE11, and for this browser where I set a rule to update an item.

      – Populate a date field with using {timestamp} does not work.
      – Populating a text string with the {currentUser:EMail} does work

      As I said all works fine in Chrome.

      Is this a limitation of the old browser somehow, is there a workaround?

      KR
      Paul

    • #30017
      Alexander Bautz
      Keymaster

      Try adding the desired date format and not just {timestamp} – like this:

      {timestamp[MM/dd/yyyy]}

      Alexander

    • #30019
      Paul Lynch
      Participant

      Works, thanks Alex!

    • #30531
      Paul Lynch
      Participant

      Can I get DFFS to populate a Date/Time column rather than a text column?

      I’m using a rule to set a field with this time date stamp..

      {timestamp[dd.MM.yyyy hh.mm.ss]}

      I’ve been using it to set a text field (works great) but this was because I could not get this to populate a default SP date and time field. The text field is populated with my local/regional time zone GMT (not default SP site timezone which is set to EST).

      The form I am building will be used across multiple timezones. So really need to populate the SP date and time field. As I beleive this is dynamic i.e. person viewing it sees the date and time in their own zone?

      Or at least the default SP timezone would be better than my own local one.

    • #30533
      Paul Lynch
      Participant

      Just to let you know that this is now populating the date, just not the time!

      {timestamp[MM/dd/yyyy HH:mm]}

      will keep trying different time permutations!

    • #30538
      Paul Lynch
      Participant

      I’ve tried so many but given up, left it on this one for now which populates the correct date (no idea which timezone) but puts time as midnight 00:00

      {timestamp[MM/dd/yyyy HH:mm:ss]}
    • #30542
      Alexander Bautz
      Keymaster

      Sorry for the late reply. A date field is set like this when using setFieldValue in custom js:

      setFieldValue("DateColumn1", ["06/10/2020","13","25"]);

      If you use the Set field value section in a rule you can set it like this:

      06/10/2020,13,25

      If you like to use the {timestamp} keyword you can do it like this:

      {timestamp[MM/dd/yyyy]},{timestamp[HH]},{timestamp[mm]}

      Alexander

    • #30549
      Paul Lynch
      Participant

      Thanks Alexander, this works great and populates the SP date and time field.

    • #30564
      Paul Lynch
      Participant

      Sorry one more question on this.

      The first two options seem to be setting a fixed time/date

      Is it possible to use the {timestamp} keyword in the custom js like this?

      setFieldValue("DateColumn1", [{timestamp[MM/dd/yyyy]},{timestamp[HH]},{timestamp[mm]}]);
    • #30570
      Alexander Bautz
      Keymaster

      To use this functionality from Custom JS you must use the internal function spjs.dffs.buildValStr like this:

      setFieldValue("DateColumn1", [spjs.dffs.buildValStr("{timestamp[MM/dd/yyyy]}"),spjs.dffs.buildValStr("{timestamp[HH]}"),spjs.dffs.buildValStr("{timestamp[mm]}")]);

      Alexander

    • #30747
      Paul Lynch
      Participant

      Thanks this worked great and Js can populate the time/date stamps on event.

      Final question on time and date formatting!

      What is the best way to show a “friendly” time/date format in the form? I have the date/column fields set to “friendly” but I think that only shows this in the list itself.

      At moment I am using this script;

      $("span.NAMEOFSPAN").html(qRes["SP_DATE_COLUMN_IN_LIST"].split(";#")[1]);

      Then showing it in HTML field

      <h4><strong>Date Issue Occurred:  </strong><span class="NAMEOFSPAN" /></h4>

      I then have to use rules to hide the SP_DATE_COLUMN_IN_LIST in the form, and replace with the HTML date field.

      Wondering if there is a more efficient way?

      • #30755
        Alexander Bautz
        Keymaster

        I’m not sure I follow – are you in a form and want to pull the date and time from a hidden date field and display it in custom HTML in a HTML section in the same form?

        Alexander

    • #30765
      Paul Lynch
      Participant

      Sorry might have confused things with the script and I also left out some code.

      Just a standard date/time field in SP – which I would like to show in a “friendly” way.. e.g.15 June 2020 rather than 15/06/20 which is how it shows in the SP form by default.

    • #30772
      Alexander Bautz
      Keymaster

      It looks like the “friendly format” is only supported in list views and not in the form. In DispForm it is possible to change the layout with custom js, but not in NewForm and EditForm.

      You can try this custom js in your DispForm to show a friendly date string:

      var dispFormDate = getFieldValue("DateColumn1");
      var dateObj = new Date(dispFormDate);
      jQuery("#dffs_DateColumn1").find(".ms-formbody").html(spjs.dffs.formatDate(dateObj,"dd MMMM yyyy"));

      Change DateColumn1 to match your field name.

      Please note that due to the parsing of the field value as string to a date, not all languages (formats) are supported. If you don’t use US date format you might have to split the string and format it properly before using the new Date(…) function.

      Alexander

    • #30809
      Paul Lynch
      Participant

      Thanks Alexander,

      only just had time to try this out but I get “undefined” which replaces the date field of DFFS form.

      Sorry I just wanted to clarify I it is not a text string I am converting it is date field. I want to show 20 June 2020, instead of 20/06/2020

      Fieldname – DateColumn1 (Internal fieldname – DateColumn1)
      Column type – Date/Time field

      Tried it on a couple of dates using internal field names of two dates on my form.

      I’m no programmer but in first line of the js create and set a variable dispFormDate as the value from the date field from DateColumn1 (DateColumn1 is the existing date field, not a text string created by a timedate stamp)

    • #30817
      Alexander Bautz
      Keymaster

      Sorry, but if this is in NewForm or EditForm there is no way to do it – the code snippet in my previous comment is for DispForm only.

      Alexander

    • #30819
      Paul Lynch
      Participant

      Sorry did not read the previous answer properly, no worries thanks for checking!

Viewing 15 reply threads
  • You must be logged in to reply to this topic.