Details

    • Type: Sub-task Sub-task
    • Status: Resolved Resolved (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 3.1 Final (3.1.1.000)
    • Fix Version/s: 4.1.0.002, 4.0.3.003
    • Labels:
      None
    • Environment:
      CentOS-5.x + Resin-3.1.9 + Railo-3.1.1.000
    • Similar Issues:
      Show 10 results 

      Description

      Hi,

      I have found a bug with SetLocale("Portuguese (Standard)") and LSParseDateTime()

      -------------------
      <cfset setLocale("Portuguese (Brazilian)") />
      <cfset testDate = LSParseDateTime( "07/10/2009" )
      -------------------
      works fine

      -------------------
      <cfset setLocale("Portuguese (Standard)") />
      <cfset testDate = LSParseDateTime( "07/10/2009" )
      -------------------
      error

      NOTE:
      Actually, I don't know it's matter.
      Brazilian Developers use tu use setLocale("Portuguese (Brazilian)"), as well as for Adobe Coldfusion, and it works fine.

      In the other hands, I don't know how the Portugueses from Portugal use.

        Activity

        Hide
        Michael Offner
        added a comment -

        the hole locale implementation has nothing to do with railo or adobeCF, this is based in both cases on java.
        in other words, java is wrong or portugal has a other locale defintion than brasil.

        pherhaps there is somebody from portugal in the mailing list to answer this question

        Show
        Michael Offner
        added a comment - the hole locale implementation has nothing to do with railo or adobeCF, this is based in both cases on java. in other words, java is wrong or portugal has a other locale defintion than brasil. pherhaps there is somebody from portugal in the mailing list to answer this question
        Hide
        Bryn Parrott
        added a comment -

        Its an easy out to blame Java for a poor implementation of lsparsedatetime.

        If I have the code
        <cfset oldlocal=setlocale('English (Australian)')>
        <cfset fred=lsparsedatetime('20/12/2012 15:36:01')> <!--- This is a valid australian date value in the standard australia (24 hour) format) --->

        Then railo says it cant cast it to a date time format, and yet the documentation says
        "Converts a string that is a valid date/time representation in the current locale into a date/time object. "

        Code that works:
        lsparsedatetime(fieldvalue,'English (Australian)','Australia/Sydney','dd/MM/yyyy HH:mm:ss')

        I'm sorry but I don't see the joke, since the Adobe implementation will work with the first version. I don't appreciate having to recode all of this because Railo decided to go one better than adobe.

        Show
        Bryn Parrott
        added a comment - Its an easy out to blame Java for a poor implementation of lsparsedatetime. If I have the code <cfset oldlocal=setlocale('English (Australian)')> <cfset fred=lsparsedatetime('20/12/2012 15:36:01')> <!--- This is a valid australian date value in the standard australia (24 hour) format) ---> Then railo says it cant cast it to a date time format, and yet the documentation says "Converts a string that is a valid date/time representation in the current locale into a date/time object. " Code that works: lsparsedatetime(fieldvalue,'English (Australian)','Australia/Sydney','dd/MM/yyyy HH:mm:ss') I'm sorry but I don't see the joke, since the Adobe implementation will work with the first version. I don't appreciate having to recode all of this because Railo decided to go one better than adobe.
        Hide
        Michael Offner
        added a comment - - edited

        supported date/time formats in JRE for ...

        Portuguese (Brazil):
        Segunda-feira, 21 de Janeiro de 2013 11h12min24s CET
        Segunda-feira, 21 de Janeiro de 2013 11h12min24s CET
        Segunda-feira, 21 de Janeiro de 2013 11:12:24
        Segunda-feira, 21 de Janeiro de 2013 11:12
        21 de Janeiro de 2013 11h12min24s CET
        21 de Janeiro de 2013 11h12min24s CET
        21 de Janeiro de 2013 11:12:24
        21 de Janeiro de 2013 11:12
        21/01/2013 11h12min24s CET
        21/01/2013 11h12min24s CET
        21/01/2013 11:12:24
        21/01/2013 11:12
        21/01/13 11h12min24s CET
        21/01/13 11h12min24s CET
        21/01/13 11:12:24
        21/01/13 11:12

        Portuguese (Standard):
        Segunda-feira, 21 de Janeiro de 2013 11H12m CET
        Segunda-feira, 21 de Janeiro de 2013 11:12:24 CET
        Segunda-feira, 21 de Janeiro de 2013 11:12:24
        Segunda-feira, 21 de Janeiro de 2013 11:12
        21 de Janeiro de 2013 11H12m CET
        21 de Janeiro de 2013 11:12:24 CET
        21 de Janeiro de 2013 11:12:24
        21 de Janeiro de 2013 11:12
        21/Jan/2013 11H12m CET
        21/Jan/2013 11:12:24 CET
        21/Jan/2013 11:12:24
        21/Jan/2013 11:12
        21-01-2013 11H12m CET
        21-01-2013 11:12:24 CET
        21-01-2013 11:12:24
        21-01-2013 11:12

        Show
        Michael Offner
        added a comment - - edited supported date/time formats in JRE for ... Portuguese (Brazil): Segunda-feira, 21 de Janeiro de 2013 11h12min24s CET Segunda-feira, 21 de Janeiro de 2013 11h12min24s CET Segunda-feira, 21 de Janeiro de 2013 11:12:24 Segunda-feira, 21 de Janeiro de 2013 11:12 21 de Janeiro de 2013 11h12min24s CET 21 de Janeiro de 2013 11h12min24s CET 21 de Janeiro de 2013 11:12:24 21 de Janeiro de 2013 11:12 21/01/2013 11h12min24s CET 21/01/2013 11h12min24s CET 21/01/2013 11:12:24 21/01/2013 11:12 21/01/13 11h12min24s CET 21/01/13 11h12min24s CET 21/01/13 11:12:24 21/01/13 11:12 Portuguese (Standard): Segunda-feira, 21 de Janeiro de 2013 11H12m CET Segunda-feira, 21 de Janeiro de 2013 11:12:24 CET Segunda-feira, 21 de Janeiro de 2013 11:12:24 Segunda-feira, 21 de Janeiro de 2013 11:12 21 de Janeiro de 2013 11H12m CET 21 de Janeiro de 2013 11:12:24 CET 21 de Janeiro de 2013 11:12:24 21 de Janeiro de 2013 11:12 21/Jan/2013 11H12m CET 21/Jan/2013 11:12:24 CET 21/Jan/2013 11:12:24 21/Jan/2013 11:12 21-01-2013 11H12m CET 21-01-2013 11:12:24 CET 21-01-2013 11:12:24 21-01-2013 11:12
        Hide
        Michael Offner
        added a comment -

        date formats:

        Portuguese (Brazil)
        Segunda-feira, 21 de Janeiro de 2013
        21 de Janeiro de 2013
        21/01/2013
        Portuguese
        Segunda-feira, 21 de Janeiro de 2013
        21 de Janeiro de 2013
        21/Jan/2013
        21-01-2013

        Show
        Michael Offner
        added a comment - date formats: Portuguese (Brazil) Segunda-feira, 21 de Janeiro de 2013 21 de Janeiro de 2013 21/01/2013 Portuguese Segunda-feira, 21 de Janeiro de 2013 21 de Janeiro de 2013 21/Jan/2013 21-01-2013
        Hide
        Michael Offner
        added a comment -

        tnx for input
        https://github.com/getrailo/railo/commit/87fdf313bede5f019b16d767ae86dd8923a773c8

        we have added the possibility to extends formats delivered by java.text.DateFormat with custom formats defined in a text file, next build will provide a file for Portuguese (Standard) including this format. so this will work out of the box and you will even be able to extend any locale with custom formats you need.

        Show
        Michael Offner
        added a comment - tnx for input https://github.com/getrailo/railo/commit/87fdf313bede5f019b16d767ae86dd8923a773c8 we have added the possibility to extends formats delivered by java.text.DateFormat with custom formats defined in a text file, next build will provide a file for Portuguese (Standard) including this format. so this will work out of the box and you will even be able to extend any locale with custom formats you need.
        Hide
        Michael Offner
        added a comment -

        to a a custom locale formats you have to add a files like the following to the Railo Webcontext

        WEB-INF/railo/locales/pt-PT-date.df
        WEB-INF/railo/locales/pt-PT-datetime.df
        WEB-INF/railo/locales/pt-PT-time.df

        the filename has to follow the following pattern
        <language><country><type>.df

        the first 2 (<language> and <country>) can be determinate very easy with help of the following code
        LocaleFactory=createObject('java','railo.runtime.i18n.LocaleFactory');
        locale=LocaleFactory.getLocale("german (swiss)");
        dump(var:locale.getLanguage(),label:"language");
        dump(var:locale.getCountry(),label:"country");

        there are 3 kind of possible pattern
        date, time or datetime pattern, with the third part of the filename (<type>) you define what kind of pattern your file contains.

        then you can add your pattern to this file, one pattern per line, the pattern have to follow the Java Date and time pattern you can found here
        http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

        Show
        Michael Offner
        added a comment - to a a custom locale formats you have to add a files like the following to the Railo Webcontext WEB-INF/railo/locales/pt-PT-date.df WEB-INF/railo/locales/pt-PT-datetime.df WEB-INF/railo/locales/pt-PT-time.df the filename has to follow the following pattern <language> <country> <type>.df the first 2 (<language> and <country>) can be determinate very easy with help of the following code LocaleFactory=createObject('java','railo.runtime.i18n.LocaleFactory'); locale=LocaleFactory.getLocale("german (swiss)"); dump(var:locale.getLanguage(),label:"language"); dump(var:locale.getCountry(),label:"country"); there are 3 kind of possible pattern date, time or datetime pattern, with the third part of the filename (<type>) you define what kind of pattern your file contains. then you can add your pattern to this file, one pattern per line, the pattern have to follow the Java Date and time pattern you can found here http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

          People

          • Assignee:
            Michael Offner
            Reporter:
            Ronan Lucio
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: