Search code examples
javascriptprototypejsdatepicker

Protoplasm Date Picker : Issue with different datetime format


I am working an application having I18N support. In this application, based on user's locale user is prompted enters date time in locale specific format along with other details in a form. We have used protoplasm date time picker to select date time.

Right now we are facing an issue with specific datetime format where the plugin shows wrong hours. Here is the html

<html>
    <head>
        <script language="javascript" src="protoplasm.js"></script>
        <script language="javascript">
            // transform() calls can be chained together
            Protoplasm.use('datepicker')
                .transform('input.datepicker', {timePicker:true, use24hrs:false, dateTimeFormat: 'dd-MM-yyyy HH:mm a'} )
                .transform('input.datetimepicker')
                ;
        </script>
    </head>
    <body>
        <input type="text" name="date" class="datepicker" />
    </body>
</html>

When user click on PM box on the plugin it shows 16-04-2012 22:59 PM instead of 16-04-2012 10:59 PM. However if he click on AM box it works.

Has anyone faced such issues?

Please help me to resolve this problem.

Thanks, Amit Patel


Solution

  • I replaced HH with hh in dateTimeFormat and it worked.