qontu / ngx-inline-editor

Native UI Inline-editor Angular (4.0+) component
https://qontu.github.io/ngx-inline-editor
MIT License
164 stars 90 forks source link

how can i set date format? #146

Open sanatani9 opened 6 years ago

sanatani9 commented 6 years ago

I have multiple inline editor on page. but i have issue with date type. when i set date format as 'y-m-d' then date value is pre-selected in inline editor, but 'm-d-y ' date format is then value is not selected, and it show "dd-mm-yyyy".

now i want my date format as 'm-d-y' so how can i set date format? can you help me?

i am attaching this SS pleas have a look.

https://www.screencast.com/t/umh3RR1koL4

sanatani9 commented 6 years ago

@xxxtonixxx can you help?

tonivj5 commented 6 years ago

Hi @archish1989, that feature isn't implemented.

And we're working in release the 1.0.0. We add this feature to release with it :+1:

sanatani9 commented 6 years ago

FYI i was in hurry so I've solve my issue like this.

template file:

<inline-editor (onCancel)="editCancle()" (onEdit)="savePrevValue($event,'paymentrecived')" empty="Enter Payment Received Date" type="date" class="clsProject" [(ngModel)]="paymentrecived" (onSave)="saveEditable($event,'paymentrecived','date')" name="paymentrecived" ></inline-editor>

ts file


let invDat = new Date(projectForm.projects.paymentrecived);
paymentrecived = dp.transform(invDat, 'MM-dd-yyyy');                        
setTimeout(function(){ 
     $( "input[ng-reflect-name='paymentrecived']" ).val(dp.transform(invDat, 'yyyy-MM-dd'));
}, 1000);

setTimeout(function(){ $( "input[ng-reflect-name='paymentrecived']" ).val(dp.transform(invDat, 'yyyy-MM-dd')); }, 1000);
This code done magic for me.

tonivj5 commented 6 years ago

Thanks for share your workaround while this feature is missing :heart: