mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
refactor: fix sorting features by last seen and created at (#755)
This commit is contained in:
parent
2bb069af6b
commit
58667565f2
@ -109,17 +109,19 @@ const sortByLastSeen = (
|
|||||||
): IFeatureToggle[] => {
|
): IFeatureToggle[] => {
|
||||||
return [...features].sort((a, b) =>
|
return [...features].sort((a, b) =>
|
||||||
a.lastSeenAt && b.lastSeenAt
|
a.lastSeenAt && b.lastSeenAt
|
||||||
? a.lastSeenAt.localeCompare(b.lastSeenAt)
|
? b.lastSeenAt.localeCompare(a.lastSeenAt)
|
||||||
: 0
|
: a.lastSeenAt
|
||||||
|
? -1
|
||||||
|
: b.lastSeenAt
|
||||||
|
? 1
|
||||||
|
: b.createdAt.localeCompare(a.createdAt)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortByCreated = (
|
const sortByCreated = (
|
||||||
features: Readonly<IFeatureToggle[]>
|
features: Readonly<IFeatureToggle[]>
|
||||||
): IFeatureToggle[] => {
|
): IFeatureToggle[] => {
|
||||||
return [...features].sort((a, b) =>
|
return [...features].sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
||||||
new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortByName = (features: Readonly<IFeatureToggle[]>): IFeatureToggle[] => {
|
const sortByName = (features: Readonly<IFeatureToggle[]>): IFeatureToggle[] => {
|
||||||
|
Loading…
Reference in New Issue
Block a user