From: Ash Date: Fri, 1 Jun 2018 05:40:30 +0000 (+0100) Subject: [bugfix] Avoid using trim() (#4564) X-Git-Tag: 2.22.2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a831fc7e2694281ce31e4f090bbcf90a690f0277;p=thirdparty%2Fmoment.git [bugfix] Avoid using trim() (#4564) --- diff --git a/src/lib/create/from-string.js b/src/lib/create/from-string.js index 7c1052a3e..c5ad56bab 100644 --- a/src/lib/create/from-string.js +++ b/src/lib/create/from-string.js @@ -128,7 +128,7 @@ function untruncateYear(yearStr) { function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space - return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim(); + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } function checkWeekday(weekdayStr, parsedInput, config) {