Custom field type Date in wrong order

HI everyone!

I have a small problem with a custom field.
I have set the style for dates as d-m-y but when I add a custom field type Date it returns y-m-d.
Is there already a way to change this that I’m overseeing?
I don’t mind changing it in the code itself but would appreciate a pointer to the right file!

Thanks!

Thats not recommended if its in a file that will be updated by any InvoicePlane updates. Because an update will reset the change.

Can you show us a code example where this happens and what exactly you custom field is?


this is my custom field.
I’ve set dates to d.m.Y. in the systems settingswhich works for invoice date etc. but with a custom field it displays as:
image

1 Like

Hm … I may have to pass on this one, as I never really used custom fields in combination with dates.
But if the formating of the date/output does not meet your requirements you can easily change this with PHP with something like this:

Short:

  1. read the actuall output, and give the actuall formating
  2. convert string to timestamp
  3. convert timestamp to date in the desired format

Sorry to say so, but in this speciall case I not not have enough experience so this workaround is all I can give you here.

Hoffe Du erreichst mit diesem kleine Workaround, was gewünscht war :wink:

1 Like

thank you for your help @M4rt1n! While trying to implement the workaround I’ve found an easy solution. Posting this for anyone, who runs into this problem as well.

If you have a custom date field, change the code from:
<?php echo $custom_fields['invoice']['my_custom_field']); ?>

to:
<?php echo date_from_mysql($custom_fields['invoice']['my_custom_field'], true); ?>

That way you make sure your date is formatted correctly!

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.