Date format in a snippet

Hi - I am using a snippet with a variable data field for the date. I have it formatted as such in the text script - formatter.dateLong(field). This works fine and displays as January 1, 2022 if I use the field anywhere in the print section. However when I use the date field in a snippet it shows as Sat Jan 01 2022 00:00:00 GMT-0500 (EST).

How do I get the date in the snippet to read the same as it does in the document? My date format in the .csv file is 1-Jan-22?

Thank you

Scripts are executed in the order in which they appear in the Scripts pane. I suggest to check the order and make sure that the Text script is executed after the one used for loading the snippet.

Erik

Thank you . I checked that and @EffDate@ (which is used in the snippet also) is located well before the script to load the snippet.

Did moving that script down in the list solved the problem?

Hi - I had it moved down to begin with so no that didn’t work.

Try disabling all scripts except for the two relevant scripts; i.e. the script that loads the snippet and the @EffDate@ script. If it now behaves as expected there might be a third script somewhere that causes the problem.

You can also use the script debugger (the button with a green bug in the Scripts panel) to step through your scripts to see how and when they affect content.