DateFormat in EditorDatatable?

DateFormat in EditorDatatable?

leandrodrleandrodr Posts: 1Questions: 1Answers: 0
edited August 2015 in Free community support

Hi everybody,
I have a doubt with DateFormat in Datatable.
please look a the creditdata field please.

javascript

 editor = new $.fn.dataTable.Editor( {
        "ajax": "_ajax/ajax_datatable.php",
        "table": "#credits",
        "fields": [ 
            {
                 label: "Account Name:",
                 name: "account_id",
                 //dataProp: "1",
                 type: "select",
                 ipOpts: getStateList()
            },{
                label: "Credit Date:",
                name:  "creditdate",
                type: "date",
                dateFormat: "mm/dd/yyyy"       
            },  {
                label: "Payment Type:",
                name:  "paymenttype",
                type:  "select",
                options: [
                    { label: "ACH/Wire", value: "ACH/Wire" },
                    { label: "Credit Card",           value: "Credit Card" },
                    { label: "PayPal",           value: "PayPal" },
                    { label: "QuickPay",           value: "QuickPay" },
                    { label: "Hand Deposit",  value: "Hand Deposit" },
                    { label: "Credit Memo",  value: "Credit Memo" },
                    { label: "Other",  value: "Other" }
                ]
            }, {
                label: "Credit Amount:",
                name:  "creditamount"
            },{
                label: "Displayed on:",
                name:  "displayedinvoice",
                type:      "checkbox",
                separator: "|",
                options:   [
                    { label: '', value: 1 }
                ]
            }, {
                label: "Comment:",
                name:  "comment",
                type:  "textarea"
            }, {
                label: "Description on Invoice:",
                name:  "descriptioninvoice",
                type:  "textarea"
            }   
        ]
    } );

php

$editor = Editor::inst( $db, 'credits' )
    ->fields(
        Field::inst( 'credits.creditid as creditid' ),
        Field::inst( 'credits.account_id as account_id' ),
            Field::inst( 'credits.creditdate as creditdate' )->getFormatter( function ( $val, $data, $opts ) {
            return date( 'm-d-Y', strtotime( $val ) );
            }) ,
        Field::inst( 'credits.paymenttype as paymenttype' ),
        Field::inst( 'credits.creditamount as creditamount' ),
        Field::inst( 'credits.displayedinvoice as displayedinvoice' ),     
        Field::inst( 'credits.comment as comment' ),    
        Field::inst( 'credits.descriptioninvoice as descriptioninvoice' ),
        Field::inst( 'credits.txn_id as txn_id' ),
        Field::inst( 'accounts.account_name as account_name' )
    )->pkey( 'creditid' )
     ->leftJoin( 'accounts', 'accounts.account_id', '=', 'credits.account_id' )
    ->process( $_POST )
    ->json();

The datatable show me a credit date with format (m-d-Y) 08-15-2015, it's ok for me, but when I click in EDIT button the field creditdate is dd/mm/YYYY, and it don't show me anything.

Look at the image please, Can anyone help me please?
http://screencast.com/t/mQAD16qlBRg

This discussion has been closed.