]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[bugfix] Avoid using trim() (#4564)
authorAsh <ash@hexmen.com>
Fri, 1 Jun 2018 05:40:30 +0000 (06:40 +0100)
committerKunal Marwaha <marwahaha@berkeley.edu>
Fri, 1 Jun 2018 05:40:30 +0000 (22:40 -0700)
src/lib/create/from-string.js

index 7c1052a3e479067f661a7eeb595f0dc397083ac7..c5ad56bab8b7cf73a8752c78673bc045ef3a2028 100644 (file)
@@ -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) {