astro-accelerator-utils 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,4 +22,11 @@ export function sortByPubDateDesc(a: MarkdownInstance, b: MarkdownInstance): any
22
22
  * @returns {any}
23
23
  */
24
24
  export function sortByModDate(a: MarkdownInstance, b: MarkdownInstance): any;
25
+ /**
26
+ * Sorts by the modDate field
27
+ * @param {MarkdownInstance} a
28
+ * @param {MarkdownInstance} b
29
+ * @returns {any}
30
+ */
31
+ export function sortByModDateDesc(a: MarkdownInstance, b: MarkdownInstance): any;
25
32
  export type MarkdownInstance = import("../types/Astro").MarkdownInstance;
@@ -37,3 +37,15 @@ export function sortByModDate (a, b) {
37
37
  const dateB = b.frontmatter.modDate || b.frontmatter.pubDate || '1970-01-01';
38
38
  return dateA.localeCompare(dateB);
39
39
  }
40
+
41
+ /**
42
+ * Sorts by the modDate field
43
+ * @param {MarkdownInstance} a
44
+ * @param {MarkdownInstance} b
45
+ * @returns {any}
46
+ */
47
+ export function sortByModDateDesc (a, b) {
48
+ const dateA = a.frontmatter.modDate || a.frontmatter.pubDate || '1970-01-01';
49
+ const dateB = b.frontmatter.modDate || b.frontmatter.pubDate || '1970-01-01';
50
+ return dateB.localeCompare(dateA);
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-accelerator-utils",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Astro utilities for Astro Accelerator.",
5
5
  "main": "index.mjs",
6
6
  "type": "module",