Jump to content

latte localDate filter


elvina
 Share

Recommended Posts

Hi Bernhard

I tried to use the Latte localDate filter in a latte template and I get "Filter not defined". 
Is there a list of latte filters that are included?

I'm just trying to get my date fields to translate as I can't get months to translate without using strftime() which is now depreciated.

thanks

Link to comment
Share on other sites

If it‘s just one language and one or two spots you need to deal with month or weekday names, I tend to use an array with e.g. the month names defined in the Latter template in combination with a PHP date format string like „n“ used as array index pointing to the month name needed (or „N“ for the weekday number). 

Edited by cwsoft
Link to comment
Share on other sites

On 12/29/2024 at 9:46 PM, bernhard said:

RockFrontend includes the HumanDates library that you can use as strftime alternative:

$rockfrontend->humandates('de_AT')->format('2025-01-01', 'd. MMMM y')

// 1. Jänner 2025

https://github.com/baumrock/HumanDates

Thanks! I'll have a go with that, though I did manage to get the inbuilt PW date translation to work. 

I had been using date() but realised i need to use $datetime->date() (as well as put translations in the WireDateTime.php file)

Oooh actually I need ranges too so HumanDates will be very useful.

Cheers!

 

  • Like 1
Link to comment
Share on other sites

  

On 12/29/2024 at 6:07 AM, elvina said:

Hi Bernhard

I tried to use the Latte localDate filter in a latte template and I get "Filter not defined". 
Is there a list of latte filters that are included?

I'm just trying to get my date fields to translate as I can't get months to translate without using strftime() which is now depreciated.

thanks

Hi Bernhard, It seems that localDate isn’t a default filter in Latte. You can refer to the Latte documentation for a list of built-in filters. To translate date fields, you might consider using PHP’s `IntlDateFormatter` or creating a custom Latte filter for localized date formatting. My friend was studying business management and often faced challenges with their writing at all academic levels. As a supportive friend, I recommended using DoMyPaper for help with their essay writing. He decided to give https://domypaper.com/ a try and is completely satisfied with the service. DoMyPaper has a team of professional writers who assist their users with various writing needs. They offer services for all academic levels and are available 24/7.

I also had the same problem, what can I do?

Edit: Anyone?

Edited by JamesFletcher
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...