DESKTOP EDITION CLOUD EDITION SERVER EDITION GUIDES FORUM

Date field type adding time to output


#1

I have added a custom field called “Requested date” and after the latest update, it is adding the time to the output. See attached screenshots (1 is from the custom field on the invoice form and 1 is the output on the form):

53%20AM 04%20AM


#2

Just following up here, I had a friend of mine who is a shopify developer look at this and tried several ways to format the date of the custom field with no luck. While I understand this is not a coding forum, it would be nice if there was some sort of documentation as to what is allowed and what is not. We tried:

{{ custom_fields["Requested date"] | date_to_string}}

and the output was

10/03/2018 00:00:00

I also would like to add a “date generated” to the forms as sort of a control to help us make sure we have the most current version of the sales order or invoice printed for the client. We tried:

Form generated at: {{ “now” | date: “%Y-%m-%d %H:%M” }}.
Form generated at: {{ “today” | date: “%Y-%m-%d %H:%M” }}.

Also no luck. These were both examples provided directly by the Liquid guides on the shopify developer site. Lastly, we tried a combination of the two, in an attempt to format the date properly on our form.

{{ custom_fields[“Requested date”] | date: “%m %d %Y”}}

Out output is:

0 3 Y

The date entered into this custom field is 10/3/2018

I don’t mind paying a developer to help with custom themes, but it seems that not all Liquid code is compatible within Manager. Can anyone provide any assistance here?


#3

It started raining here pretty good, so I tinkered with this again, and I finally got it to appear correctly, but I still think there needs to be some documentation as to the limits of the Liquid code base within Manager. For example

%Y indicates a 4 digit year, and %y indicates a 2 digit year. Using %Y does not work, my workaround was to use 20%y to produce “2018” as the output.

{{ custom_fields["Requested date"] | date: "%M/%d/20%y"}}

I don’t believe this is good code, but it is what needed to be done to match the Issue Date and Due Date hard coded field’s format.


#4

In the latest version (18.9.1), you don’t need any date filter. The date will be automatically formatted based on your date format set under Preferences.


#5

Thanks! Any idea how we can make the now or today functions work? They are available in liquid but not functioning in Manager.


#6

It seems like you can do something like this:

{{ 'today' | date: 'MM/dd/yyyy' }} to get current date.