AngularJS filter on date, display only time if year/month/day the same -
I'm new to Angular JS, for the item I have the start date and end date if year / month / day I want to display only the time (HHMM) to finish the date. If they are different then I want to show everything. Like this:
{{item.bDate | Date: 'dd.m.m.yyy hh: mm'}} - {{item.eDate | Date: 'DDMMYY HH: MM'}} Any sign on how to do this?
Change your HTML:
{{item.bDate | Date: getDateFormat (item.bDate, item.eDate)}} - {{item.eDate | Date: getDateFormat (item.bDate, item.eDate)}} and creates this function in your controller: $ scope.getDateFormat = Function (bDate, eDate) {var startDate = new date (BDT); Var Enddate = New Date (EDT); If (beginDate.getDate () == endDate.getDate ()) 'HH: mm' return; Second return 'DD. MMY HH: MM '; }
Comments
Post a Comment