« get me outta code hell

data: support dash-style short dates in commentary dates - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/wiki-data.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-18 19:33:38 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-18 19:33:38 -0400
commite874f7e4d0df5fed25d4c359c8cb403e67061e59 (patch)
tree73341e0ceba50152521998771651aff2a861deff /src/util/wiki-data.js
parent522c982bf0b5a0bd39512eb56a9d0d8d8feea44e (diff)
data: support dash-style short dates in commentary dates
Diffstat (limited to 'src/util/wiki-data.js')
-rw-r--r--src/util/wiki-data.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 09b3623..5e3182a 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -644,7 +644,7 @@ export function sortFlashesChronologically(data, {
 //   * "December 25, 2019" - one all-letters word, a space, one or two number
 //     digits, a comma, and four number digits
 //   * "12/25/2019" etc - three sets of one to four number digits, separated
-//     by slashes (only valid formats are MM/DD/YYYY and YYYY/MM/DD)
+//     by slashes or dashes (only valid orders are MM/DD/YYYY and YYYY/MM/DD)
 //
 // Capturing group "artistReference" is all the characters between <i> and </i>
 // (apart from the pipe and "artistDisplayText" text, if present), and is either
@@ -654,7 +654,7 @@ export function sortFlashesChronologically(data, {
 // out of the original string based on the indices matched using this.
 //
 export const commentaryRegex =
-  /^<i>(?<artistReferences>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)$))*?)(?:,? ?(?<date>[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,4}\/[0-9]{1,4}\/[0-9]{1,4}))?\))?$/gm;
+  /^<i>(?<artistReferences>.+?)(?:\|(?<artistDisplayText>.+))?:<\/i>(?: \((?<annotation>(?:.*?(?=,|\)$))*?)(?:,? ?(?<date>[a-zA-Z]+ [0-9]{1,2}, [0-9]{4,4}|[0-9]{1,2} [^,]*[0-9]{4,4}|[0-9]{1,4}[-/][0-9]{1,4}[-/][0-9]{1,4}))?\))?$/gm;
 
 export function filterAlbumsByCommentary(albums) {
   return albums