Closed spalt closed 8 years ago
Sorry, at the beginning, date-format
was implemented but removed because of Angular2 date pipe limit and IE bugs. Thus, current date-format
is not working and we will make it better in the future.
no problem! i forked your repo and made a change for my needs for now.
If you find a general solution for date formatting, I am be very interested in.
Hi, i'm interested to format date, do you have any solution ? thanks you, best regards
There is a plan to implement this one, but at this moment it's not a simple solution. That's why I do not implement this one yet.
Currently ngModel
should be a string, but to format properl;
1.ngModel
as string as it is
ngModel
as string as it isngModel
as a "Date", not a stringEach idea has its own pros and cons.
Hi @allenhwkim , I try idea3, but not working.
Component import * as moment from 'moment'; ..... executeDateStart= moment().format('L'); console.log(executeDateStart); // 05/08/2016 :+1:
HTML
<input class="form-control" [(ngModel)]="executeDateStart" name="executeDateStart" ng2-datetime-picker date-only="true" />
the format shown remains yyyy-MM-dd :-1:
:(
@josepoma
Formatting date is provided by DateTime service https://github.com/ng2-ui/ng2-datetime-picker/blob/6b57d25ef3f065055551d245b9fc3033163e0dab/dist/datetime.ts#L91
And it is used by DateTimePicker Directive https://github.com/ng2-ui/ng2-datetime-picker/blob/6b57d25ef3f065055551d245b9fc3033163e0dab/dist/datetime-picker.directive.ts#L67
So, if you follow idea 3, you need to change those codes.
date-format is not enabled with the help of moment.js. Idea 3 has been implemented
Yes. thanks for help everyOne...... for me I included moment.js in my index file its working fine for me. if i ignore this then i must ignore the date-formate also to activate functionality ... including the date-format i can see the calendar but cannot see date i selected in the input box...
Is it just me or is it doing yMd even when you specify something else?
<input [(ngModel)]="date2" datetime-picker date-format="Mdy" date-only="true" />
still shows as 2015-01-01