fix(posts): robust date sorting in post and comment processors

This commit is contained in:
Scott Idem
2026-02-12 15:22:28 -05:00
parent 5e9457580c
commit c4009391c0
2 changed files with 6 additions and 4 deletions

View File

@@ -549,12 +549,13 @@ export async function process_ae_obj__post_props({
}
obj.name = obj.title;
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
const updated = obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on ?? obj.created_on}`;
}_${updated}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on}_${obj.created_on}`;
}_${obj.updated_on ?? ''}_${obj.created_on ?? ''}`;
return obj;
}

View File

@@ -366,12 +366,13 @@ export async function process_ae_obj__post_comment_props({
log_lvl,
specific_processor: (obj) => {
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
const updated = obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on ?? obj.created_on}`;
}_${updated}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on}_${obj.created_on}`;
}_${obj.updated_on ?? ''}_${obj.created_on ?? ''}`;
return obj;
}