SimpleInvoices Group Forum › Forums › Fearless359 SimpleInvoices Discussion Group › Date format
Tagged: date format, locale
- This topic has 11 replies, 3 voices, and was last updated 3 years, 4 months ago by RRowley.
-
AuthorPosts
-
December 22, 2020 at 7:54 am #1279ExpertGeeksParticipant
Hi,
I’ve noticed that the date is MM/DD/YYYY. Everything I can think of is set to en_GB (and so should be DD/MM/YYY). How can I fix this ? Thanks.December 23, 2020 at 7:32 am #1280RRowleyParticipantI’ve standardized the date format displayed on screens to the database format, yyyy-mm-dd. The value on the invoice, expense and payment view screens had been missed. The most recent update, Version: 2020.0.11, corrects this.
If you want a difference format for the printed invoice, you’ll need to develop a custom template.
January 6, 2021 at 9:49 am #1288ExpertGeeksParticipantI’ve downloaded the zip from github, but it seems to be a revision off;
Version: 2020.0.10 — 20201217
This is still showing the date in MM-DD-YYYY format. How/where would I need to edit this to make changes to the date format ? My template references this field using;
{$invoice.date|utilDate}
- This reply was modified 3 years, 11 months ago by ExpertGeeks.
January 6, 2021 at 10:02 am #1290ExpertGeeksParticipantI also tried a git clone and copying across the usual config files etc etc and I get;
PdoDb – construct error: SQLSTATE[HY000] [1698] Access denied for user ‘root’@’localhost’ (Error code: 0)
January 6, 2021 at 1:59 pm #1291ExpertGeeksParticipantI’ve manually made the changes listed here;
https://github.com/fearless359/simpleinvoices/commit/62c86040ae3cc154aa3e76bc51d1f8fd25f16155
to my working copy of 2020.0.10 which should bring me up to v2020.0.11. Despite all dates now showing as YYYY-MM-DD in the menus, they’re still MM-DD-YYYY in the print preview and the PDF’s for both the
default
template and my owneg-invoice
template.- This reply was modified 3 years, 11 months ago by ExpertGeeks.
January 6, 2021 at 2:21 pm #1293ExpertGeeksParticipantApologies, I think the version issue might have been to a permission on the config folder. I’ve tried the update again and now it shows 2020.0.11, however the print preview and the pdfs still have the date formate of MM-DD-YYYY. I’d be very happy with your new format of YYYY-MM-DD, I think this format makes the most sense. If only I could get the PDF’s to comply !
January 7, 2021 at 5:51 am #1294RRowleyParticipantPDF’s are an exception to the rule. They contain their own code to display values and any changes you want to make require you to implement a customized version. Check out the directions for the Invoice Templates & Styles menu link to the left.
January 8, 2021 at 6:48 am #1295ExpertGeeksParticipantThe default template (which the “Invoices Templates & Styles” you referenced to edit) renders the date in MM-DD-YYYY format.
I can’t put this any more plainly, how can I get the default template to display the date in the format YYYY-MM-DD ?
January 8, 2021 at 10:53 am #1296RRowleyParticipantYou need to make a custom template. The instructions I mentioned tell you how to initially set this up. You can copy the default directory to a new directory named for example, “mypdf”, and then modify line 35 of the template.tpl file and change
{$invoice.date|utilDate}
to{$invoice.date|htmlSafe}
.January 20, 2021 at 3:48 am #1328ExpertGeeksParticipantThanks Richard. Can I recommend you amended this in the default template? Cheers.
August 18, 2021 at 10:57 pm #1577nayakwebParticipantHi, can someone let me know how to change the date format to dd-mmm-yyyy and the locale to en_IN?
August 19, 2021 at 1:15 pm #1578RRowleyParticipantLet’s start with the locale. Currently there is no en_IN locale defined. But you can remedy that quite simply. In the lang directory, make an “en_IN” directory. Then copy into it the info.xml and lang.php file from whichever language directory most closely matches what you want. If that is the en_US directory, then in the copied lang.php file, delete the lines at the end following the $LANG[‘zip’]… line (the ones in the if statement for setting the user password help format).
Modify the information in the copied, info.xml file.
At this point you now have an “en_IN” locale set up. Of course the words in the lang.php file have not been translated. You can do that as necessary. Once you have your lang.php file set up, you can send me copies of both the xml and php file via an attached zip file containing them, via this forum. I’ll add them to the standard application for future users, etc.
With these files set up, there are two places where you set en_IN to use it in field formatting and language selection. First is in the config/custom.config.ini file “localLocale” setting. The next is in the Settings/Inv Prefs tabs records, set both the Language and Locale fields to en_IN.
As for the date. In the screens that display the date, the format is as it comes from the database. “yyyy-mm-dd” I believe. This is standard and yields a natural sorting order for the field if you order the management tables by it.
For the invoice templates, you get whatever they display. You can modify them and make your own invoice formatting for dates and other information however you please; but it isn’t necessarily controlled by the locale settings.
Hope this helps.
- This reply was modified 3 years, 4 months ago by RRowley.
-
AuthorPosts
- You must be logged in to reply to this topic.
Recent Comments