I'm attempting to implement column sorting in an AngularJS md-data-table for a column containing dates. These dates are formatted as strings DD / MM / YYYY, but I'm struggling to get them sorted correctly. I've tried calling a function that returns the timestamp of the date using the md-order-by attribute, but the function isn't being called at all. The current code snippet is shown below, with the "Fecha Nacimiento" column being the one I'm trying to sort:
<table md-table md-row-select="options.rowSelection" multiple="{{options.multiSelect}}" ng-model="selected"
md-progress="promise">
<thead md-head md-order="query.order">
<tr md-row>
<th md-column md-order-by="id"><span>Identificador</span></th>
<th md-column md-numeric md-order-by="fechaTimestamp(fechaNacimiento)"><span>Fecha Nacimiento</span></th>
<th md-column md-order-by="sexo"><span>Sexo</span></th>
<th md-column md-numeric md-order-by="altura"><span>Altura(cm)</span></th>
<th md-column><span>Grabaciones</span></th>
<th md-column><span>Atributos extra</span></th>
</tr>
</thead>
<tbody md-body>
<tr md-row md-select="paciente" md-on-select="logItem" md-auto-select="options.autoSelect"
ng-repeat="paciente in pacientes.data | filter: filter.search | orderBy: query.order | limitTo: query.limit : (query.page -1) * query.limit">
<td md-cell ng-click="editarCampo($event, paciente, 'identificador')"
ng-class="{'md-placeholder': !paciente.id}">{{paciente.id || 'Añadir identificador'}}
</td>
<td md-cell ng-click="editarFecha($event, paciente)" ng-class="{'md-placeholder': !paciente.fechaNacimiento}">
{{paciente.fechaNacimiento
|| "Añadir fecha nacimiento"}}
</td>
<td md-cell>
<md-select ng-model="paciente.sexo" name="sexo" ng-change="editarSexo(paciente)" placeholder="Sexo" required>
<md-option value="Hombre">Hombre</md-option>
<md-option value="Mujer">Mujer</md-option>
<md-option value="Otro">Otro</md-option>
</md-select>
</td>
<td md-cell ng-click="editarCampo($event, paciente, 'altura')"
ng-class="{'md-placeholder': !paciente.altura}">{{paciente.altura || 'Añadir altura'}}
</td>
<td md-cell>
<md-button ng-click="redirect('grabaciones/' + paciente.id)"
style="background: lightgrey;" ng-show="paciente.grabaciones"
title="Ver grabaciones de {{paciente.id}}">Ver
</md-button>
</td>
<td md-cell>
<md-button ng-click="verAtributosExtra($event,paciente)" ng-show="paciente.extra"
style="background: lightgrey;"
title="Ver información extra de {{paciente.id}}">Ver
</md-button>
<md-button ng-click="verAtributosExtra($event,paciente)" ng-hide="paciente.extra"
style="background: lightgrey;"
title="Añadir atributos extra a {{paciente.id}}">Añadir
</md-button>
</td>
</tr>
</tbody>
</table>
Many thanks for any assistance provided.