We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21301
    • 93 Posts
    Have you looked at the way the TV-var is stored in the database? In my case it is stored as a formatted date. Though this is TP3 wink I’m talking about.

    Does anybody know if there’s been changes in this area? I’d expect formatting TV-dates should work with ’getTemplateVarOuput’.

    When I saw it was stored formatted in the database instead of eg a unix timestamp I haven’t looked any further.

    Does someone know how date TV’s are stored in the database in version 0.9.1 (and beyond)? Any change since TP3?
    • I don’t think the db values have changed. Unfortunately, there’s a lot of rework that is needed to make things easier to handle multilingual sites with proper localization, and that’s really important for us too!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 6726
        • 7,075 Posts
        Ok, in the meantime I’ll stick with a d%/m%/y% formatting.

        Maybe madmage will be able to help on this as well...
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 21301
          • 93 Posts
          The latest version of the ChildDocumentMapper snippet works With the default API and has a function to convert the dates to unix timestamps. This makes it possible to sort on date-TV’s (or any other field) without a problem.

          If there’s anything that I can do to help with the rework towards l10n and i18n please let me know.
            • 6726
            • 7,075 Posts
            Update : Nissai suggested I use setlocale directly on top of the language file (for me, francais.inc.php) and guess what : it works site wide !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id
              • 33175
              • 711 Posts
              Hello,

              Date localization makes problems (the french community can testified).
              To display the date in french, set_local() is a good idea but that not resolved all problems.

              In some snippets, strftime() is not used to format date : date() is used but this function is not affected by set_local(). It will be possible to recommend to the developers to use strftime() instead of date() ?

              Another problem. If the date includes accents, for example "février" (February in French), and ModX is configured with UTF-8, the accented character is not displayed as well. I have created a little snippet to resolved this. It will be possible to add a core function to Modx to format date like this snippet does it ?

              Thanks

                Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
              • Mea culpa! I didn’t realize there was such a difference between the functions. I, for one, shall go through all of my snippets/modules/plugins to make sure I fix this.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 6726
                  • 7,075 Posts
                  It’s really cool that Guillaume figured this out and offered a snippet, especially since localization is on top of priorities right now grin
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l'outil id
                  • Great work, Guillaume! smiley I, too, will ensure that I use strftime() in future.

                    Just to throw an idea around, is it time that there was some ’coding’ guidelines formulated so that people could have a definite resource to consult for the best way to approach l10n and i18n issues.

                    Cheers, Garry
                      Garry Nutting
                      Senior Developer
                      MODX, LLC

                      Email: [email protected]
                      Twitter: @garryn
                      Web: modx.com