From 2c8a5ffd971f00648e7bc5f48993fc187f3179f2 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Sat, 5 Aug 2017 02:00:23 +0800 Subject: [PLT-2407] Improve ordering of uploaded attachments (#7022) * improve ordering of uploaded attachments * use LocalizationStore.getLocale() when comparing file names --- webapp/utils/utils.jsx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index f12fcefba..89e031a3c 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -475,6 +475,11 @@ export function splitFileLocation(fileLocation) { return {ext, name: filename, path: filePath}; } +export function sortFilesByName(files) { + const locale = LocalizationStore.getLocale(); + return Array.from(files).sort((a, b) => a.name.localeCompare(b.name, locale, {numeric: true})); +} + export function toTitleCase(str) { function doTitleCase(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); -- cgit v1.2.3-1-g7c22