michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
32 stars 44 forks source link

any text after course start date is trimmed #166

Closed mohamedmohamedatia closed 2 years ago

mohamedmohamedatia commented 3 years ago

when I tried to put any text after the start date code the text is trimmed for example I tried to enter all below codes in a custom course field and in an activity description I got the result "Held from Wednesday, 8 September 2021" however the correct should be "Held from Wednesday, 8 September 2021 to Thursday, 8 September 2021"

Held from {coursestartdate strftimedaydatetime} to {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate strftimedatemonthabbr} to {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate strftimedaytime} to {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate strftimerecentfull} to {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate strftimedaydate} to {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate %d %B %Y, %I:%M %p} to {courseenddate %d %B %Y, %I:%M %p}

Note this is fr the start date only, the end date is working fine for example I used the below and the result is as expected To {courseenddate %d %B %Y, %I:%M %p} Held from {coursestartdate %d %B %Y, %I:%M %p} and the result is To 9 September 2021, 3:00 PM Held from Wednesday, 8 September 2021 which is correct

michael-milette commented 2 years ago

Hi @mohamedmohamedatia ,

Thank you for taking the time to report this. Using the information you provided, I was able to reproduce the issue. I will look into it when I have a chance. However, in the meantime, please note:

Date formats similar to "%d %B %Y, %I:%M %p" may work but they are unsupported at this time. During development, I noticed these often caused problems with content that followed.

It is not ideal but, if you put the coursestartdate and courseenddate in two separate fields, it seems to work.

Hope this helps for now. I will let you know once this issue has been resolved.

Best regards,

Michael

mohamedmohamedatia commented 2 years ago

Thank you, for your reply, I really liked your plugin it is very very useful, I recently knew about it, a couple of months ago and we now use it in all-new courses. and we will try in the main menu as well, but I guess it is not working in the user menu, I will check it again and will report it if it is not working.

you are correct when I use start date alone or end date alone it works perfectly, I will use your advice and will not use this format "%d %B %Y, %I:%M %p" anymore, I will update my template.

Regards

michael-milette commented 2 years ago

Hi @mohamedmohamedatia

Whether it works in the various menus really depends on the theme. If it doesn't work user menu, I suggest you ask the author do the same to fix it by passing the content through the output API functions. More information is available in the README.md file.

Best regards,

Michael

michael-milette commented 2 years ago

Hi @mohamedmohamedatia

I think I have the issues with the date/time-related tags fixed. This includes the following tags:

This fix addresses the issues described in #166 , #168 and #191 including cutting off of text and multiple instances of these tags not appearing or not being processed correctly.

The fix has been pushed to the code here on GitHub for now. If you have a chance, I would appreciate it very much if you would try it out and let me know if it works properly for you. If it does, I will include the fix in the upcoming release of FilterCodes on Moodle.org.

Best regards,

Michael

michael-milette commented 2 years ago

I am closing this issue with the assumption that it is all working now as there has been no feedback for over a month. If there is a problem, please open a new issue and mention issue #166.

Best regards,

Michael