Home › Forums › Classic DFFS › {timestamp} not working in IE
- This topic has 16 replies, 2 voices, and was last updated 4 years, 5 months ago by Paul Lynch.
-
AuthorPosts
-
-
May 18, 2020 at 11:03 #30015
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 workAs I said all works fine in Chrome.
Is this a limitation of the old browser somehow, is there a workaround?
KR
Paul -
May 18, 2020 at 11:17 #30017
Try adding the desired date format and not just {timestamp} – like this:
{timestamp[MM/dd/yyyy]}
Alexander
-
May 18, 2020 at 11:21 #30019
Works, thanks Alex!
-
June 9, 2020 at 21:15 #30531
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.
-
June 9, 2020 at 21:28 #30533
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!
-
June 10, 2020 at 10:45 #30538
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]}
-
June 10, 2020 at 12:21 #30542
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
-
June 10, 2020 at 13:04 #30549
Thanks Alexander, this works great and populates the SP date and time field.
-
June 10, 2020 at 14:52 #30564
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]}]);
-
June 10, 2020 at 15:59 #30570
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
-
June 24, 2020 at 08:47 #30747
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?
-
June 24, 2020 at 17:46 #30755
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
-
-
June 25, 2020 at 07:50 #30765
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.
-
June 25, 2020 at 15:30 #30772
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
-
June 30, 2020 at 14:56 #30809
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 fieldTried 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)
-
June 30, 2020 at 15:57 #30817
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
-
June 30, 2020 at 16:31 #30819
Sorry did not read the previous answer properly, no worries thanks for checking!
-
-
AuthorPosts
- You must be logged in to reply to this topic.