0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 00:52:48 +00:00

Add brew tag sorting

This commit is contained in:
G.Ambatte
2023-12-03 19:14:20 +13:00
parent ab8716d071
commit cfecc001aa

View File

@@ -115,6 +115,9 @@ const BrewItem = createClass({
const brew = this.props.brew;
if(Array.isArray(brew.tags)) { // temporary fix until dud tags are cleaned
brew.tags = brew.tags?.filter((tag)=>tag); //remove tags that are empty strings
brew.tags.sort((a, b)=>{
return a.indexOf(':') - b.indexOf(':') != 0 ? a.indexOf(':') - b.indexOf(':') : a.localeCompare(b);
});
}
const dateFormatString = 'YYYY-MM-DD HH:mm:ss';