From ebc366cdec3e079e0a356092085a268a8bbbadfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Valney?= Date: Wed, 10 May 2017 22:53:06 -0300 Subject: [PATCH 1/2] Fixing o2.Utilities.phpToMoment to support escaping --- js/utils/timestamp.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/utils/timestamp.js b/js/utils/timestamp.js index cef0de3..c59f023 100644 --- a/js/utils/timestamp.js +++ b/js/utils/timestamp.js @@ -7,6 +7,12 @@ o2.Utilities.phpToMoment = function( s ) { var m = ''; var lookBehind = ''; for ( var i = 0; i < s.length; i++ ) { + if ( lookBehind === "\\" ) { // Scaping character + m += '[' + s.charAt( i ) + ']'; + lookBehind = s.charAt( i ); + continue; + } + switch ( s.charAt( i ) ) { case 'd': // Day of the month with leading zeroes m += 'DD'; @@ -106,6 +112,7 @@ o2.Utilities.phpToMoment = function( s ) { case 'u': // Microseconds case 'I': // Daylight savings time case 'Z': // Timezone offset in seconds + case '\\': // Scape character break; // Handle with lookBehind to handle 'jS' From e4efb783c4274b426da42cb05134c38e45d5b722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Valney?= Date: Mon, 13 Aug 2018 10:06:21 -0300 Subject: [PATCH 2/2] Fix typo --- js/utils/timestamp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/utils/timestamp.js b/js/utils/timestamp.js index c59f023..9f078eb 100644 --- a/js/utils/timestamp.js +++ b/js/utils/timestamp.js @@ -7,7 +7,7 @@ o2.Utilities.phpToMoment = function( s ) { var m = ''; var lookBehind = ''; for ( var i = 0; i < s.length; i++ ) { - if ( lookBehind === "\\" ) { // Scaping character + if ( lookBehind === "\\" ) { // Escaping character m += '[' + s.charAt( i ) + ']'; lookBehind = s.charAt( i ); continue; @@ -112,7 +112,7 @@ o2.Utilities.phpToMoment = function( s ) { case 'u': // Microseconds case 'I': // Daylight savings time case 'Z': // Timezone offset in seconds - case '\\': // Scape character + case '\\': // Escaping character break; // Handle with lookBehind to handle 'jS'