I think it’s ideal that the backend sends timestamp to the front and you suit the necessary.
Ordination it is better to use with timestamp because it is only a number, in the Java
be the type long
or of wrapper
Long
.
Example:
var datasOrdenadas = datasEmTimestamp.sort(function(data1, data2) {
return data1 > data2
});
In case you wanted filter in front-end you can use the power and flexibility of the javascript
and its frameworks as the AngularJS
that you yourself commented, to adjust your objects to your needs.
Example:
Supposing you received timestamp from your webservice
and using AngularJS
.
var datasTratada = datasEmTimestamp.map(function(data) {
var date = new Date(data);
var dataTratada = {
formatada: $filter('date')(data, 'dd/MM/YYYY - HH:mm'),
dia: date.getDate(),
mes: date.getMonth(),
ano: date.getFullYear(),
hora: date.getHours(),
minuto: date.getMinutes()
}
return dataTratada;
});
Ai of a list of dates on timestamp
you get a plethora of information about the dates and can work as you wish. In the case of AngularJS
, a look at the documentation of its date filter, it is very complete: https://docs.angularjs.org/api/ng/filter/date.
A great library to work with dates in javascript is also the Moment.js.
In what language is your backend?
– novic
The backend is in Java, but I mean the use in front-end.
– Murillo Goulart