locutus 2.0.31 → 2.0.34
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.
- package/README.md +84 -0
- package/_data/rosetta.yml +325 -0
- package/awk/builtin/index.js +3 -0
- package/awk/builtin/int.js +13 -0
- package/awk/builtin/length.js +16 -0
- package/awk/builtin/substr.js +23 -0
- package/c/ctype/index.js +8 -0
- package/c/ctype/isalnum.js +15 -0
- package/c/ctype/isalpha.js +17 -0
- package/c/ctype/isdigit.js +15 -0
- package/c/ctype/islower.js +15 -0
- package/c/ctype/isspace.js +15 -0
- package/c/ctype/isupper.js +15 -0
- package/c/ctype/tolower.js +15 -0
- package/c/ctype/toupper.js +15 -0
- package/c/index.js +2 -5
- package/c/math/abs.js +14 -18
- package/c/math/frexp.js +19 -20
- package/c/math/index.js +2 -5
- package/c/stdio/index.js +1 -4
- package/c/stdio/sprintf.js +71 -81
- package/c/stdlib/atof.js +15 -0
- package/c/stdlib/atoi.js +17 -0
- package/c/stdlib/index.js +2 -0
- package/c/string/index.js +5 -0
- package/c/string/strcat.js +12 -0
- package/c/string/strchr.js +15 -0
- package/c/string/strcmp.js +21 -0
- package/c/string/strlen.js +12 -0
- package/c/string/strstr.js +15 -0
- package/clojure/Math/abs.js +13 -0
- package/clojure/Math/ceil.js +15 -0
- package/clojure/Math/floor.js +14 -0
- package/clojure/Math/index.js +3 -0
- package/elixir/Float/ceil.js +16 -0
- package/elixir/Float/floor.js +14 -0
- package/elixir/Float/index.js +2 -0
- package/elixir/Kernel/abs.js +13 -0
- package/elixir/Kernel/index.js +1 -0
- package/golang/index.js +1 -4
- package/golang/strconv/Atoi.js +26 -0
- package/golang/strconv/FormatBool.js +12 -0
- package/golang/strconv/FormatInt.js +21 -0
- package/golang/strconv/Itoa.js +14 -0
- package/golang/strconv/ParseBool.js +35 -0
- package/golang/strconv/ParseInt.js +27 -0
- package/golang/strconv/index.js +6 -0
- package/golang/strings/Compare.js +19 -0
- package/golang/strings/Contains.js +7 -9
- package/golang/strings/ContainsAny.js +18 -0
- package/golang/strings/Count.js +20 -22
- package/golang/strings/EqualFold.js +13 -0
- package/golang/strings/Fields.js +12 -0
- package/golang/strings/HasPrefix.js +15 -0
- package/golang/strings/HasSuffix.js +20 -0
- package/golang/strings/Index.js +11 -0
- package/golang/strings/Index2.js +9 -11
- package/golang/strings/IndexAny.js +18 -0
- package/golang/strings/Join.js +16 -0
- package/golang/strings/LastIndex.js +10 -12
- package/golang/strings/LastIndexAny.js +18 -0
- package/golang/strings/Repeat.js +19 -0
- package/golang/strings/Replace.js +44 -0
- package/golang/strings/Split.js +24 -0
- package/golang/strings/ToLower.js +9 -0
- package/golang/strings/ToUpper.js +9 -0
- package/golang/strings/Trim.js +19 -0
- package/golang/strings/TrimLeft.js +15 -0
- package/golang/strings/TrimPrefix.js +14 -0
- package/golang/strings/TrimRight.js +15 -0
- package/golang/strings/TrimSpace.js +10 -0
- package/golang/strings/TrimSuffix.js +14 -0
- package/golang/strings/index.js +25 -7
- package/index.js +5 -8
- package/julia/Base/abs.js +13 -0
- package/julia/Base/ceil.js +16 -0
- package/julia/Base/floor.js +14 -0
- package/julia/Base/index.js +3 -0
- package/lua/math/abs.js +13 -0
- package/lua/math/ceil.js +16 -0
- package/lua/math/floor.js +14 -0
- package/lua/math/index.js +3 -0
- package/package.json +37 -51
- package/perl/POSIX/ceil.js +16 -0
- package/perl/POSIX/floor.js +14 -0
- package/perl/POSIX/index.js +2 -0
- package/perl/core/index.js +1 -0
- package/perl/core/length.js +16 -0
- package/php/_helpers/_bc.js +524 -515
- package/php/_helpers/_phpCastString.js +20 -25
- package/php/_helpers/_php_cast_float.js +5 -10
- package/php/_helpers/_php_cast_int.js +6 -11
- package/php/_helpers/index.js +4 -7
- package/php/array/array_change_key_case.js +11 -16
- package/php/array/array_chunk.js +20 -23
- package/php/array/array_column.js +22 -72
- package/php/array/array_combine.js +13 -18
- package/php/array/array_count_values.js +35 -39
- package/php/array/array_diff.js +11 -14
- package/php/array/array_diff_assoc.js +11 -14
- package/php/array/array_diff_key.js +11 -14
- package/php/array/array_diff_uassoc.js +15 -19
- package/php/array/array_diff_ukey.js +14 -17
- package/php/array/array_fill.js +11 -13
- package/php/array/array_fill_keys.js +5 -8
- package/php/array/array_filter.js +12 -13
- package/php/array/array_flip.js +13 -15
- package/php/array/array_intersect.js +13 -16
- package/php/array/array_intersect_assoc.js +13 -16
- package/php/array/array_intersect_key.js +15 -18
- package/php/array/array_intersect_uassoc.js +17 -20
- package/php/array/array_intersect_ukey.js +17 -20
- package/php/array/array_key_exists.js +4 -7
- package/php/array/array_keys.js +22 -24
- package/php/array/array_map.js +24 -29
- package/php/array/array_merge.js +22 -25
- package/php/array/array_merge_recursive.js +51 -27
- package/php/array/array_multisort.js +138 -130
- package/php/array/array_pad.js +24 -26
- package/php/array/array_pop.js +10 -13
- package/php/array/array_product.js +15 -17
- package/php/array/array_push.js +16 -19
- package/php/array/array_rand.js +11 -14
- package/php/array/array_reduce.js +11 -14
- package/php/array/array_replace.js +9 -12
- package/php/array/array_replace_recursive.js +20 -24
- package/php/array/array_reverse.js +12 -15
- package/php/array/array_search.js +27 -29
- package/php/array/array_shift.js +3 -6
- package/php/array/array_slice.js +37 -39
- package/php/array/array_splice.js +64 -69
- package/php/array/array_sum.js +7 -12
- package/php/array/array_udiff.js +14 -17
- package/php/array/array_udiff_assoc.js +14 -17
- package/php/array/array_udiff_uassoc.js +17 -20
- package/php/array/array_uintersect.js +16 -19
- package/php/array/array_uintersect_uassoc.js +18 -21
- package/php/array/array_unique.js +12 -15
- package/php/array/array_unshift.js +4 -7
- package/php/array/array_values.js +11 -13
- package/php/array/array_walk.js +10 -15
- package/php/array/array_walk_recursive.js +15 -20
- package/php/array/arsort.js +50 -52
- package/php/array/asort.js +50 -51
- package/php/array/count.js +15 -14
- package/php/array/current.js +30 -32
- package/php/array/each.js +32 -35
- package/php/array/end.js +27 -30
- package/php/array/in_array.js +7 -10
- package/php/array/index.js +73 -76
- package/php/array/key.js +32 -34
- package/php/array/krsort.js +50 -51
- package/php/array/ksort.js +50 -51
- package/php/array/natcasesort.js +37 -38
- package/php/array/natsort.js +35 -36
- package/php/array/next.js +34 -36
- package/php/array/pos.js +10 -12
- package/php/array/prev.js +32 -34
- package/php/array/range.js +30 -33
- package/php/array/reset.js +24 -27
- package/php/array/rsort.js +47 -49
- package/php/array/shuffle.js +16 -18
- package/php/array/sizeof.js +3 -6
- package/php/array/sort.js +43 -45
- package/php/array/uasort.js +19 -21
- package/php/array/uksort.js +22 -24
- package/php/array/usort.js +20 -22
- package/php/bc/bcadd.js +16 -19
- package/php/bc/bccomp.js +12 -15
- package/php/bc/bcdiv.js +17 -20
- package/php/bc/bcmul.js +16 -19
- package/php/bc/bcround.js +21 -24
- package/php/bc/bcscale.js +8 -11
- package/php/bc/bcsub.js +16 -19
- package/php/bc/index.js +7 -10
- package/php/ctype/ctype_alnum.js +14 -16
- package/php/ctype/ctype_alpha.js +14 -16
- package/php/ctype/ctype_cntrl.js +9 -12
- package/php/ctype/ctype_digit.js +14 -16
- package/php/ctype/ctype_graph.js +14 -16
- package/php/ctype/ctype_lower.js +14 -16
- package/php/ctype/ctype_print.js +14 -16
- package/php/ctype/ctype_punct.js +14 -16
- package/php/ctype/ctype_space.js +9 -12
- package/php/ctype/ctype_upper.js +14 -16
- package/php/ctype/ctype_xdigit.js +14 -16
- package/php/ctype/index.js +11 -14
- package/php/datetime/checkdate.js +15 -17
- package/php/datetime/date.js +142 -123
- package/php/datetime/date_parse.js +18 -21
- package/php/datetime/getdate.js +38 -24
- package/php/datetime/gettimeofday.js +7 -10
- package/php/datetime/gmdate.js +17 -16
- package/php/datetime/gmmktime.js +23 -25
- package/php/datetime/gmstrftime.js +17 -14
- package/php/datetime/idate.js +44 -38
- package/php/datetime/index.js +15 -18
- package/php/datetime/microtime.js +11 -14
- package/php/datetime/mktime.js +14 -17
- package/php/datetime/strftime.js +122 -113
- package/php/datetime/strptime.js +210 -191
- package/php/datetime/strtotime.js +615 -496
- package/php/datetime/time.js +11 -13
- package/php/exec/escapeshellarg.js +16 -18
- package/php/exec/index.js +1 -4
- package/php/filesystem/basename.js +22 -24
- package/php/filesystem/dirname.js +12 -14
- package/php/filesystem/file_exists.js +12 -0
- package/php/filesystem/file_get_contents.js +3 -6
- package/php/filesystem/index.js +6 -8
- package/php/filesystem/pathinfo.js +47 -46
- package/php/filesystem/realpath.js +16 -19
- package/php/funchand/call_user_func.js +4 -7
- package/php/funchand/call_user_func_array.js +19 -22
- package/php/funchand/create_function.js +4 -7
- package/php/funchand/function_exists.js +4 -8
- package/php/funchand/get_defined_functions.js +25 -32
- package/php/funchand/index.js +5 -8
- package/php/i18n/i18n_loc_get_default.js +7 -10
- package/php/i18n/i18n_loc_set_default.js +12 -15
- package/php/i18n/index.js +2 -5
- package/php/index.js +20 -23
- package/php/info/assert_options.js +25 -27
- package/php/info/getenv.js +8 -10
- package/php/info/index.js +6 -9
- package/php/info/ini_get.js +9 -12
- package/php/info/ini_set.js +32 -34
- package/php/info/set_time_limit.js +8 -11
- package/php/info/version_compare.js +43 -44
- package/php/json/index.js +3 -6
- package/php/json/json_decode.js +42 -28
- package/php/json/json_encode.js +89 -66
- package/php/json/json_last_error.js +11 -13
- package/php/math/abs.js +2 -5
- package/php/math/acos.js +2 -5
- package/php/math/acosh.js +7 -9
- package/php/math/asin.js +2 -5
- package/php/math/asinh.js +7 -9
- package/php/math/atan.js +7 -9
- package/php/math/atan2.js +7 -9
- package/php/math/atanh.js +2 -5
- package/php/math/base_convert.js +8 -10
- package/php/math/bindec.js +12 -14
- package/php/math/ceil.js +7 -9
- package/php/math/cos.js +7 -9
- package/php/math/cosh.js +7 -9
- package/php/math/decbin.js +16 -18
- package/php/math/dechex.js +3 -6
- package/php/math/decoct.js +13 -15
- package/php/math/deg2rad.js +8 -10
- package/php/math/exp.js +7 -9
- package/php/math/expm1.js +9 -11
- package/php/math/floor.js +7 -9
- package/php/math/fmod.js +27 -29
- package/php/math/getrandmax.js +7 -9
- package/php/math/hexdec.js +10 -12
- package/php/math/hypot.js +8 -11
- package/php/math/index.js +46 -49
- package/php/math/is_finite.js +9 -14
- package/php/math/is_infinite.js +9 -14
- package/php/math/is_nan.js +8 -13
- package/php/math/lcg_value.js +8 -10
- package/php/math/log.js +8 -10
- package/php/math/log10.js +12 -14
- package/php/math/log1p.js +15 -17
- package/php/math/max.js +54 -59
- package/php/math/min.js +54 -59
- package/php/math/mt_getrandmax.js +7 -9
- package/php/math/mt_rand.js +15 -17
- package/php/math/octdec.js +8 -10
- package/php/math/pi.js +2 -5
- package/php/math/pow.js +2 -5
- package/php/math/rad2deg.js +8 -10
- package/php/math/rand.js +15 -17
- package/php/math/round.js +48 -49
- package/php/math/sin.js +7 -9
- package/php/math/sinh.js +7 -9
- package/php/math/sqrt.js +7 -9
- package/php/math/tan.js +7 -9
- package/php/math/tanh.js +8 -10
- package/php/misc/index.js +2 -5
- package/php/misc/pack.js +173 -165
- package/php/misc/uniqid.js +20 -23
- package/php/net-gopher/gopher_parsedir.js +27 -29
- package/php/net-gopher/index.js +1 -4
- package/php/network/index.js +6 -9
- package/php/network/inet_ntop.js +15 -15
- package/php/network/inet_pton.js +30 -34
- package/php/network/ip2long.js +25 -15
- package/php/network/long2ip.js +8 -10
- package/php/network/setcookie.js +11 -13
- package/php/network/setrawcookie.js +16 -19
- package/php/pcre/index.js +4 -7
- package/php/pcre/preg_match.js +3 -6
- package/php/pcre/preg_quote.js +2 -5
- package/php/pcre/preg_replace.js +8 -11
- package/php/pcre/sql_regcase.js +17 -20
- package/php/strings/addcslashes.js +86 -88
- package/php/strings/addslashes.js +15 -16
- package/php/strings/bin2hex.js +19 -43
- package/php/strings/chop.js +8 -10
- package/php/strings/chr.js +12 -14
- package/php/strings/chunk_split.js +15 -17
- package/php/strings/convert_cyr_string.js +137 -50
- package/php/strings/convert_uuencode.js +35 -38
- package/php/strings/count_chars.js +29 -27
- package/php/strings/crc32.js +276 -21
- package/php/strings/echo.js +28 -30
- package/php/strings/explode.js +31 -26
- package/php/strings/get_html_translation_table.js +123 -122
- package/php/strings/hex2bin.js +21 -21
- package/php/strings/html_entity_decode.js +31 -33
- package/php/strings/htmlentities.js +38 -34
- package/php/strings/htmlspecialchars.js +20 -23
- package/php/strings/htmlspecialchars_decode.js +19 -21
- package/php/strings/implode.js +23 -27
- package/php/strings/index.js +91 -94
- package/php/strings/join.js +8 -10
- package/php/strings/lcfirst.js +9 -11
- package/php/strings/levenshtein.js +37 -39
- package/php/strings/localeconv.js +12 -15
- package/php/strings/ltrim.js +12 -14
- package/php/strings/md5.js +216 -223
- package/php/strings/md5_file.js +17 -19
- package/php/strings/metaphone.js +112 -117
- package/php/strings/money_format.js +139 -126
- package/php/strings/nl2br.js +24 -26
- package/php/strings/nl_langinfo.js +32 -35
- package/php/strings/number_format.js +19 -22
- package/php/strings/ord.js +19 -21
- package/php/strings/parse_str.js +53 -56
- package/php/strings/printf.js +6 -9
- package/php/strings/quoted_printable_decode.js +7 -10
- package/php/strings/quoted_printable_encode.js +19 -20
- package/php/strings/quotemeta.js +7 -9
- package/php/strings/rtrim.js +14 -16
- package/php/strings/setlocale.js +148 -104
- package/php/strings/sha1.js +108 -106
- package/php/strings/sha1_file.js +15 -17
- package/php/strings/similar_text.js +34 -33
- package/php/strings/soundex.js +34 -36
- package/php/strings/split.js +8 -10
- package/php/strings/sprintf.js +112 -114
- package/php/strings/sscanf.js +99 -96
- package/php/strings/str_getcsv.js +37 -32
- package/php/strings/str_ireplace.js +50 -55
- package/php/strings/str_pad.js +18 -21
- package/php/strings/str_repeat.js +14 -16
- package/php/strings/str_replace.js +32 -37
- package/php/strings/str_rot13.js +15 -17
- package/php/strings/str_shuffle.js +12 -15
- package/php/strings/str_split.js +19 -21
- package/php/strings/str_word_count.js +51 -50
- package/php/strings/strcasecmp.js +12 -14
- package/php/strings/strchr.js +10 -12
- package/php/strings/strcmp.js +12 -14
- package/php/strings/strcoll.js +9 -12
- package/php/strings/strcspn.js +30 -25
- package/php/strings/strip_tags.js +50 -52
- package/php/strings/stripos.js +12 -14
- package/php/strings/stripslashes.js +8 -10
- package/php/strings/stristr.js +15 -17
- package/php/strings/strlen.js +23 -26
- package/php/strings/strnatcasecmp.js +6 -8
- package/php/strings/strnatcmp.js +47 -46
- package/php/strings/strncasecmp.js +30 -32
- package/php/strings/strncmp.js +5 -7
- package/php/strings/strpbrk.js +12 -14
- package/php/strings/strpos.js +11 -13
- package/php/strings/strrchr.js +7 -10
- package/php/strings/strrev.js +188 -10
- package/php/strings/strripos.js +16 -18
- package/php/strings/strrpos.js +20 -22
- package/php/strings/strspn.js +24 -26
- package/php/strings/strstr.js +20 -22
- package/php/strings/strtok.js +14 -16
- package/php/strings/strtolower.js +8 -10
- package/php/strings/strtoupper.js +8 -10
- package/php/strings/strtr.js +38 -43
- package/php/strings/substr.js +14 -18
- package/php/strings/substr_compare.js +18 -20
- package/php/strings/substr_count.js +11 -14
- package/php/strings/substr_replace.js +5 -8
- package/php/strings/trim.js +53 -32
- package/php/strings/ucfirst.js +11 -13
- package/php/strings/ucwords.js +3 -6
- package/php/strings/vprintf.js +6 -9
- package/php/strings/vsprintf.js +8 -10
- package/php/strings/wordwrap.js +32 -35
- package/php/url/base64_decode.js +42 -40
- package/php/url/base64_encode.js +51 -53
- package/php/url/http_build_query.js +27 -32
- package/php/url/index.js +8 -11
- package/php/url/parse_url.js +61 -25
- package/php/url/rawurldecode.js +8 -8
- package/php/url/rawurlencode.js +9 -6
- package/php/url/urldecode.js +9 -8
- package/php/url/urlencode.js +11 -6
- package/php/var/boolval.js +31 -33
- package/php/var/doubleval.js +10 -12
- package/php/var/empty.js +11 -16
- package/php/var/floatval.js +13 -15
- package/php/var/gettype.js +22 -23
- package/php/var/index.js +30 -33
- package/php/var/intval.js +35 -39
- package/php/var/is_array.js +27 -31
- package/php/var/is_binary.js +2 -5
- package/php/var/is_bool.js +10 -12
- package/php/var/is_buffer.js +2 -5
- package/php/var/is_callable.js +34 -35
- package/php/var/is_double.js +10 -12
- package/php/var/is_float.js +12 -14
- package/php/var/is_int.js +20 -22
- package/php/var/is_integer.js +12 -14
- package/php/var/is_long.js +3 -6
- package/php/var/is_null.js +9 -11
- package/php/var/is_numeric.js +30 -6
- package/php/var/is_object.js +4 -9
- package/php/var/is_real.js +3 -6
- package/php/var/is_scalar.js +2 -8
- package/php/var/is_string.js +9 -11
- package/php/var/is_unicode.js +12 -15
- package/php/var/isset.js +9 -12
- package/php/var/print_r.js +49 -53
- package/php/var/serialize.js +47 -52
- package/php/var/serialize.vitest.ts +10 -0
- package/php/var/strval.js +10 -13
- package/php/var/unserialize.js +168 -202
- package/php/var/var_dump.js +105 -104
- package/php/var/var_export.js +64 -66
- package/php/xdiff/index.js +2 -5
- package/php/xdiff/xdiff_string_diff.js +240 -226
- package/php/xdiff/xdiff_string_patch.js +98 -93
- package/php/xml/index.js +2 -5
- package/php/xml/utf8_decode.js +40 -42
- package/php/xml/utf8_encode.js +40 -42
- package/python/index.js +1 -4
- package/python/math/ceil.js +17 -0
- package/python/math/exp.js +12 -0
- package/python/math/fabs.js +14 -0
- package/python/math/factorial.js +29 -0
- package/python/math/floor.js +14 -0
- package/python/math/gcd.js +23 -0
- package/python/math/index.js +15 -0
- package/python/math/isfinite.js +14 -0
- package/python/math/isinf.js +14 -0
- package/python/math/isnan.js +14 -0
- package/python/math/log.js +16 -0
- package/python/math/log10.js +14 -0
- package/python/math/log2.js +14 -0
- package/python/math/pow.js +14 -0
- package/python/math/sqrt.js +14 -0
- package/python/math/trunc.js +14 -0
- package/python/string/ascii_letters.js +14 -14
- package/python/string/ascii_lowercase.js +12 -16
- package/python/string/ascii_uppercase.js +12 -16
- package/python/string/capwords.js +4 -7
- package/python/string/digits.js +10 -0
- package/python/string/hexdigits.js +10 -0
- package/python/string/index.js +10 -8
- package/python/string/octdigits.js +10 -0
- package/python/string/printable.js +15 -0
- package/python/string/punctuation.js +5 -7
- package/python/string/whitespace.js +10 -0
- package/r/base/abs.js +13 -0
- package/r/base/ceiling.js +16 -0
- package/r/base/floor.js +14 -0
- package/r/base/index.js +3 -0
- package/ruby/Array/compact.js +18 -0
- package/ruby/Array/first.js +22 -0
- package/ruby/Array/flatten.js +22 -0
- package/ruby/Array/index.js +6 -0
- package/ruby/Array/last.js +22 -0
- package/ruby/Array/sample.js +31 -0
- package/ruby/Array/uniq.js +16 -0
- package/ruby/Math/acos.js +2 -5
- package/ruby/Math/asin.js +11 -0
- package/ruby/Math/atan.js +11 -0
- package/ruby/Math/cbrt.js +13 -0
- package/ruby/Math/cos.js +12 -0
- package/ruby/Math/cosh.js +11 -0
- package/ruby/Math/exp.js +11 -0
- package/ruby/Math/index.js +15 -4
- package/ruby/Math/log.js +11 -0
- package/ruby/Math/log10.js +13 -0
- package/ruby/Math/log2.js +13 -0
- package/ruby/Math/sin.js +12 -0
- package/ruby/Math/sinh.js +11 -0
- package/ruby/Math/sqrt.js +13 -0
- package/ruby/Math/tan.js +11 -0
- package/ruby/Math/tanh.js +11 -0
- package/ruby/String/capitalize.js +19 -0
- package/ruby/String/chomp.js +27 -0
- package/ruby/String/chop.js +25 -0
- package/ruby/String/downcase.js +10 -0
- package/ruby/String/end_with.js +17 -0
- package/ruby/String/include.js +12 -0
- package/ruby/String/index.js +11 -0
- package/ruby/String/length.js +12 -0
- package/ruby/String/reverse.js +12 -0
- package/ruby/String/start_with.js +14 -0
- package/ruby/String/strip.js +12 -0
- package/ruby/String/upcase.js +10 -0
- package/ruby/index.js +1 -4
- package/_util/cli.js +0 -14
- package/_util/cli.js.map +0 -1
- package/_util/util.js +0 -620
- package/_util/util.js.map +0 -1
- package/c/index.js.map +0 -1
- package/c/math/abs.js.map +0 -1
- package/c/math/frexp.js.map +0 -1
- package/c/math/index.js.map +0 -1
- package/c/stdio/index.js.map +0 -1
- package/c/stdio/sprintf.js.map +0 -1
- package/golang/index.js.map +0 -1
- package/golang/strings/Contains.js.map +0 -1
- package/golang/strings/Count.js.map +0 -1
- package/golang/strings/Index2.js.map +0 -1
- package/golang/strings/LastIndex.js.map +0 -1
- package/golang/strings/index.js.map +0 -1
- package/index.js.map +0 -1
- package/php/_helpers/_bc.js.map +0 -1
- package/php/_helpers/_phpCastString.js.map +0 -1
- package/php/_helpers/_php_cast_float.js.map +0 -1
- package/php/_helpers/_php_cast_int.js.map +0 -1
- package/php/_helpers/index.js.map +0 -1
- package/php/array/array_change_key_case.js.map +0 -1
- package/php/array/array_chunk.js.map +0 -1
- package/php/array/array_column.js.map +0 -1
- package/php/array/array_combine.js.map +0 -1
- package/php/array/array_count_values.js.map +0 -1
- package/php/array/array_diff.js.map +0 -1
- package/php/array/array_diff_assoc.js.map +0 -1
- package/php/array/array_diff_key.js.map +0 -1
- package/php/array/array_diff_uassoc.js.map +0 -1
- package/php/array/array_diff_ukey.js.map +0 -1
- package/php/array/array_fill.js.map +0 -1
- package/php/array/array_fill_keys.js.map +0 -1
- package/php/array/array_filter.js.map +0 -1
- package/php/array/array_flip.js.map +0 -1
- package/php/array/array_intersect.js.map +0 -1
- package/php/array/array_intersect_assoc.js.map +0 -1
- package/php/array/array_intersect_key.js.map +0 -1
- package/php/array/array_intersect_uassoc.js.map +0 -1
- package/php/array/array_intersect_ukey.js.map +0 -1
- package/php/array/array_key_exists.js.map +0 -1
- package/php/array/array_keys.js.map +0 -1
- package/php/array/array_map.js.map +0 -1
- package/php/array/array_merge.js.map +0 -1
- package/php/array/array_merge_recursive.js.map +0 -1
- package/php/array/array_multisort.js.map +0 -1
- package/php/array/array_pad.js.map +0 -1
- package/php/array/array_pop.js.map +0 -1
- package/php/array/array_product.js.map +0 -1
- package/php/array/array_push.js.map +0 -1
- package/php/array/array_rand.js.map +0 -1
- package/php/array/array_reduce.js.map +0 -1
- package/php/array/array_replace.js.map +0 -1
- package/php/array/array_replace_recursive.js.map +0 -1
- package/php/array/array_reverse.js.map +0 -1
- package/php/array/array_search.js.map +0 -1
- package/php/array/array_shift.js.map +0 -1
- package/php/array/array_slice.js.map +0 -1
- package/php/array/array_splice.js.map +0 -1
- package/php/array/array_sum.js.map +0 -1
- package/php/array/array_udiff.js.map +0 -1
- package/php/array/array_udiff_assoc.js.map +0 -1
- package/php/array/array_udiff_uassoc.js.map +0 -1
- package/php/array/array_uintersect.js.map +0 -1
- package/php/array/array_uintersect_uassoc.js.map +0 -1
- package/php/array/array_unique.js.map +0 -1
- package/php/array/array_unshift.js.map +0 -1
- package/php/array/array_values.js.map +0 -1
- package/php/array/array_walk.js.map +0 -1
- package/php/array/array_walk_recursive.js.map +0 -1
- package/php/array/arsort.js.map +0 -1
- package/php/array/asort.js.map +0 -1
- package/php/array/count.js.map +0 -1
- package/php/array/current.js.map +0 -1
- package/php/array/each.js.map +0 -1
- package/php/array/end.js.map +0 -1
- package/php/array/in_array.js.map +0 -1
- package/php/array/index.js.map +0 -1
- package/php/array/key.js.map +0 -1
- package/php/array/krsort.js.map +0 -1
- package/php/array/ksort.js.map +0 -1
- package/php/array/natcasesort.js.map +0 -1
- package/php/array/natsort.js.map +0 -1
- package/php/array/next.js.map +0 -1
- package/php/array/pos.js.map +0 -1
- package/php/array/prev.js.map +0 -1
- package/php/array/range.js.map +0 -1
- package/php/array/reset.js.map +0 -1
- package/php/array/rsort.js.map +0 -1
- package/php/array/shuffle.js.map +0 -1
- package/php/array/sizeof.js.map +0 -1
- package/php/array/sort.js.map +0 -1
- package/php/array/uasort.js.map +0 -1
- package/php/array/uksort.js.map +0 -1
- package/php/array/usort.js.map +0 -1
- package/php/bc/bcadd.js.map +0 -1
- package/php/bc/bccomp.js.map +0 -1
- package/php/bc/bcdiv.js.map +0 -1
- package/php/bc/bcmul.js.map +0 -1
- package/php/bc/bcround.js.map +0 -1
- package/php/bc/bcscale.js.map +0 -1
- package/php/bc/bcsub.js.map +0 -1
- package/php/bc/index.js.map +0 -1
- package/php/ctype/ctype_alnum.js.map +0 -1
- package/php/ctype/ctype_alpha.js.map +0 -1
- package/php/ctype/ctype_cntrl.js.map +0 -1
- package/php/ctype/ctype_digit.js.map +0 -1
- package/php/ctype/ctype_graph.js.map +0 -1
- package/php/ctype/ctype_lower.js.map +0 -1
- package/php/ctype/ctype_print.js.map +0 -1
- package/php/ctype/ctype_punct.js.map +0 -1
- package/php/ctype/ctype_space.js.map +0 -1
- package/php/ctype/ctype_upper.js.map +0 -1
- package/php/ctype/ctype_xdigit.js.map +0 -1
- package/php/ctype/index.js.map +0 -1
- package/php/datetime/checkdate.js.map +0 -1
- package/php/datetime/date.js.map +0 -1
- package/php/datetime/date_parse.js.map +0 -1
- package/php/datetime/getdate.js.map +0 -1
- package/php/datetime/gettimeofday.js.map +0 -1
- package/php/datetime/gmdate.js.map +0 -1
- package/php/datetime/gmmktime.js.map +0 -1
- package/php/datetime/gmstrftime.js.map +0 -1
- package/php/datetime/idate.js.map +0 -1
- package/php/datetime/index.js.map +0 -1
- package/php/datetime/microtime.js.map +0 -1
- package/php/datetime/mktime.js.map +0 -1
- package/php/datetime/strftime.js.map +0 -1
- package/php/datetime/strptime.js.map +0 -1
- package/php/datetime/strtotime.js.map +0 -1
- package/php/datetime/time.js.map +0 -1
- package/php/exec/escapeshellarg.js.map +0 -1
- package/php/exec/index.js.map +0 -1
- package/php/filesystem/basename.js.map +0 -1
- package/php/filesystem/dirname.js.map +0 -1
- package/php/filesystem/file_get_contents.js.map +0 -1
- package/php/filesystem/index.js.map +0 -1
- package/php/filesystem/pathinfo.js.map +0 -1
- package/php/filesystem/realpath.js.map +0 -1
- package/php/funchand/call_user_func.js.map +0 -1
- package/php/funchand/call_user_func_array.js.map +0 -1
- package/php/funchand/create_function.js.map +0 -1
- package/php/funchand/function_exists.js.map +0 -1
- package/php/funchand/get_defined_functions.js.map +0 -1
- package/php/funchand/index.js.map +0 -1
- package/php/i18n/i18n_loc_get_default.js.map +0 -1
- package/php/i18n/i18n_loc_set_default.js.map +0 -1
- package/php/i18n/index.js.map +0 -1
- package/php/index.js.map +0 -1
- package/php/info/assert_options.js.map +0 -1
- package/php/info/getenv.js.map +0 -1
- package/php/info/index.js.map +0 -1
- package/php/info/ini_get.js.map +0 -1
- package/php/info/ini_set.js.map +0 -1
- package/php/info/set_time_limit.js.map +0 -1
- package/php/info/version_compare.js.map +0 -1
- package/php/json/index.js.map +0 -1
- package/php/json/json_decode.js.map +0 -1
- package/php/json/json_encode.js.map +0 -1
- package/php/json/json_last_error.js.map +0 -1
- package/php/math/abs.js.map +0 -1
- package/php/math/acos.js.map +0 -1
- package/php/math/acosh.js.map +0 -1
- package/php/math/asin.js.map +0 -1
- package/php/math/asinh.js.map +0 -1
- package/php/math/atan.js.map +0 -1
- package/php/math/atan2.js.map +0 -1
- package/php/math/atanh.js.map +0 -1
- package/php/math/base_convert.js.map +0 -1
- package/php/math/bindec.js.map +0 -1
- package/php/math/ceil.js.map +0 -1
- package/php/math/cos.js.map +0 -1
- package/php/math/cosh.js.map +0 -1
- package/php/math/decbin.js.map +0 -1
- package/php/math/dechex.js.map +0 -1
- package/php/math/decoct.js.map +0 -1
- package/php/math/deg2rad.js.map +0 -1
- package/php/math/exp.js.map +0 -1
- package/php/math/expm1.js.map +0 -1
- package/php/math/floor.js.map +0 -1
- package/php/math/fmod.js.map +0 -1
- package/php/math/getrandmax.js.map +0 -1
- package/php/math/hexdec.js.map +0 -1
- package/php/math/hypot.js.map +0 -1
- package/php/math/index.js.map +0 -1
- package/php/math/is_finite.js.map +0 -1
- package/php/math/is_infinite.js.map +0 -1
- package/php/math/is_nan.js.map +0 -1
- package/php/math/lcg_value.js.map +0 -1
- package/php/math/log.js.map +0 -1
- package/php/math/log10.js.map +0 -1
- package/php/math/log1p.js.map +0 -1
- package/php/math/max.js.map +0 -1
- package/php/math/min.js.map +0 -1
- package/php/math/mt_getrandmax.js.map +0 -1
- package/php/math/mt_rand.js.map +0 -1
- package/php/math/octdec.js.map +0 -1
- package/php/math/pi.js.map +0 -1
- package/php/math/pow.js.map +0 -1
- package/php/math/rad2deg.js.map +0 -1
- package/php/math/rand.js.map +0 -1
- package/php/math/round.js.map +0 -1
- package/php/math/sin.js.map +0 -1
- package/php/math/sinh.js.map +0 -1
- package/php/math/sqrt.js.map +0 -1
- package/php/math/tan.js.map +0 -1
- package/php/math/tanh.js.map +0 -1
- package/php/misc/index.js.map +0 -1
- package/php/misc/pack.js.map +0 -1
- package/php/misc/uniqid.js.map +0 -1
- package/php/net-gopher/gopher_parsedir.js.map +0 -1
- package/php/net-gopher/index.js.map +0 -1
- package/php/network/index.js.map +0 -1
- package/php/network/inet_ntop.js.map +0 -1
- package/php/network/inet_pton.js.map +0 -1
- package/php/network/ip2long.js.map +0 -1
- package/php/network/long2ip.js.map +0 -1
- package/php/network/setcookie.js.map +0 -1
- package/php/network/setrawcookie.js.map +0 -1
- package/php/pcre/index.js.map +0 -1
- package/php/pcre/preg_match.js.map +0 -1
- package/php/pcre/preg_quote.js.map +0 -1
- package/php/pcre/preg_replace.js.map +0 -1
- package/php/pcre/sql_regcase.js.map +0 -1
- package/php/strings/addcslashes.js.map +0 -1
- package/php/strings/addslashes.js.map +0 -1
- package/php/strings/bin2hex.js.map +0 -1
- package/php/strings/chop.js.map +0 -1
- package/php/strings/chr.js.map +0 -1
- package/php/strings/chunk_split.js.map +0 -1
- package/php/strings/convert_cyr_string.js.map +0 -1
- package/php/strings/convert_uuencode.js.map +0 -1
- package/php/strings/count_chars.js.map +0 -1
- package/php/strings/crc32.js.map +0 -1
- package/php/strings/echo.js.map +0 -1
- package/php/strings/explode.js.map +0 -1
- package/php/strings/get_html_translation_table.js.map +0 -1
- package/php/strings/hex2bin.js.map +0 -1
- package/php/strings/html_entity_decode.js.map +0 -1
- package/php/strings/htmlentities.js.map +0 -1
- package/php/strings/htmlspecialchars.js.map +0 -1
- package/php/strings/htmlspecialchars_decode.js.map +0 -1
- package/php/strings/implode.js.map +0 -1
- package/php/strings/index.js.map +0 -1
- package/php/strings/join.js.map +0 -1
- package/php/strings/lcfirst.js.map +0 -1
- package/php/strings/levenshtein.js.map +0 -1
- package/php/strings/localeconv.js.map +0 -1
- package/php/strings/ltrim.js.map +0 -1
- package/php/strings/md5.js.map +0 -1
- package/php/strings/md5_file.js.map +0 -1
- package/php/strings/metaphone.js.map +0 -1
- package/php/strings/money_format.js.map +0 -1
- package/php/strings/nl2br.js.map +0 -1
- package/php/strings/nl_langinfo.js.map +0 -1
- package/php/strings/number_format.js.map +0 -1
- package/php/strings/ord.js.map +0 -1
- package/php/strings/parse_str.js.map +0 -1
- package/php/strings/printf.js.map +0 -1
- package/php/strings/quoted_printable_decode.js.map +0 -1
- package/php/strings/quoted_printable_encode.js.map +0 -1
- package/php/strings/quotemeta.js.map +0 -1
- package/php/strings/rtrim.js.map +0 -1
- package/php/strings/setlocale.js.map +0 -1
- package/php/strings/sha1.js.map +0 -1
- package/php/strings/sha1_file.js.map +0 -1
- package/php/strings/similar_text.js.map +0 -1
- package/php/strings/soundex.js.map +0 -1
- package/php/strings/split.js.map +0 -1
- package/php/strings/sprintf.js.map +0 -1
- package/php/strings/sscanf.js.map +0 -1
- package/php/strings/str_getcsv.js.map +0 -1
- package/php/strings/str_ireplace.js.map +0 -1
- package/php/strings/str_pad.js.map +0 -1
- package/php/strings/str_repeat.js.map +0 -1
- package/php/strings/str_replace.js.map +0 -1
- package/php/strings/str_rot13.js.map +0 -1
- package/php/strings/str_shuffle.js.map +0 -1
- package/php/strings/str_split.js.map +0 -1
- package/php/strings/str_word_count.js.map +0 -1
- package/php/strings/strcasecmp.js.map +0 -1
- package/php/strings/strchr.js.map +0 -1
- package/php/strings/strcmp.js.map +0 -1
- package/php/strings/strcoll.js.map +0 -1
- package/php/strings/strcspn.js.map +0 -1
- package/php/strings/strip_tags.js.map +0 -1
- package/php/strings/stripos.js.map +0 -1
- package/php/strings/stripslashes.js.map +0 -1
- package/php/strings/stristr.js.map +0 -1
- package/php/strings/strlen.js.map +0 -1
- package/php/strings/strnatcasecmp.js.map +0 -1
- package/php/strings/strnatcmp.js.map +0 -1
- package/php/strings/strncasecmp.js.map +0 -1
- package/php/strings/strncmp.js.map +0 -1
- package/php/strings/strpbrk.js.map +0 -1
- package/php/strings/strpos.js.map +0 -1
- package/php/strings/strrchr.js.map +0 -1
- package/php/strings/strrev.js.map +0 -1
- package/php/strings/strripos.js.map +0 -1
- package/php/strings/strrpos.js.map +0 -1
- package/php/strings/strspn.js.map +0 -1
- package/php/strings/strstr.js.map +0 -1
- package/php/strings/strtok.js.map +0 -1
- package/php/strings/strtolower.js.map +0 -1
- package/php/strings/strtoupper.js.map +0 -1
- package/php/strings/strtr.js.map +0 -1
- package/php/strings/substr.js.map +0 -1
- package/php/strings/substr_compare.js.map +0 -1
- package/php/strings/substr_count.js.map +0 -1
- package/php/strings/substr_replace.js.map +0 -1
- package/php/strings/trim.js.map +0 -1
- package/php/strings/ucfirst.js.map +0 -1
- package/php/strings/ucwords.js.map +0 -1
- package/php/strings/vprintf.js.map +0 -1
- package/php/strings/vsprintf.js.map +0 -1
- package/php/strings/wordwrap.js.map +0 -1
- package/php/url/base64_decode.js.map +0 -1
- package/php/url/base64_encode.js.map +0 -1
- package/php/url/http_build_query.js.map +0 -1
- package/php/url/index.js.map +0 -1
- package/php/url/parse_url.js.map +0 -1
- package/php/url/rawurldecode.js.map +0 -1
- package/php/url/rawurlencode.js.map +0 -1
- package/php/url/urldecode.js.map +0 -1
- package/php/url/urlencode.js.map +0 -1
- package/php/var/boolval.js.map +0 -1
- package/php/var/doubleval.js.map +0 -1
- package/php/var/empty.js.map +0 -1
- package/php/var/floatval.js.map +0 -1
- package/php/var/gettype.js.map +0 -1
- package/php/var/index.js.map +0 -1
- package/php/var/intval.js.map +0 -1
- package/php/var/is_array.js.map +0 -1
- package/php/var/is_binary.js.map +0 -1
- package/php/var/is_bool.js.map +0 -1
- package/php/var/is_buffer.js.map +0 -1
- package/php/var/is_callable.js.map +0 -1
- package/php/var/is_double.js.map +0 -1
- package/php/var/is_float.js.map +0 -1
- package/php/var/is_int.js.map +0 -1
- package/php/var/is_integer.js.map +0 -1
- package/php/var/is_long.js.map +0 -1
- package/php/var/is_null.js.map +0 -1
- package/php/var/is_numeric.js.map +0 -1
- package/php/var/is_object.js.map +0 -1
- package/php/var/is_real.js.map +0 -1
- package/php/var/is_scalar.js.map +0 -1
- package/php/var/is_string.js.map +0 -1
- package/php/var/is_unicode.js.map +0 -1
- package/php/var/isset.js.map +0 -1
- package/php/var/print_r.js.map +0 -1
- package/php/var/serialize.js.map +0 -1
- package/php/var/serialize.mocha.js +0 -14
- package/php/var/serialize.mocha.js.map +0 -1
- package/php/var/strval.js.map +0 -1
- package/php/var/unserialize.js.map +0 -1
- package/php/var/var_dump.js.map +0 -1
- package/php/var/var_export.js.map +0 -1
- package/php/xdiff/index.js.map +0 -1
- package/php/xdiff/xdiff_string_diff.js.map +0 -1
- package/php/xdiff/xdiff_string_patch.js.map +0 -1
- package/php/xml/index.js.map +0 -1
- package/php/xml/utf8_decode.js.map +0 -1
- package/php/xml/utf8_encode.js.map +0 -1
- package/python/index.js.map +0 -1
- package/python/string/ascii_letters.js.map +0 -1
- package/python/string/ascii_lowercase.js.map +0 -1
- package/python/string/ascii_uppercase.js.map +0 -1
- package/python/string/capwords.js.map +0 -1
- package/python/string/index.js.map +0 -1
- package/python/string/punctuation.js.map +0 -1
- package/ruby/Math/acos.js.map +0 -1
- package/ruby/Math/index.js.map +0 -1
- package/ruby/index.js.map +0 -1
|
@@ -1,69 +1,67 @@
|
|
|
1
|
-
'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var reDateNoYear = reMonthText + '[ .\\t-]*' + reDay + '[,.stndrh\\t ]*';
|
|
1
|
+
const reSpace = '[ \\t]+'
|
|
2
|
+
const reSpaceOpt = '[ \\t]*'
|
|
3
|
+
const reMeridian = '(?:([ap])\\.?m\\.?([\\t ]|$))'
|
|
4
|
+
const reHour24 = '(2[0-4]|[01]?[0-9])'
|
|
5
|
+
const reHour24lz = '([01][0-9]|2[0-4])'
|
|
6
|
+
const reHour12 = '(0?[1-9]|1[0-2])'
|
|
7
|
+
const reMinute = '([0-5]?[0-9])'
|
|
8
|
+
const reMinutelz = '([0-5][0-9])'
|
|
9
|
+
const reSecond = '(60|[0-5]?[0-9])'
|
|
10
|
+
const reSecondlz = '(60|[0-5][0-9])'
|
|
11
|
+
const reFrac = '(?:\\.([0-9]+))'
|
|
12
|
+
|
|
13
|
+
const reDayfull = 'sunday|monday|tuesday|wednesday|thursday|friday|saturday'
|
|
14
|
+
const reDayabbr = 'sun|mon|tue|wed|thu|fri|sat'
|
|
15
|
+
const reDaytext = reDayfull + '|' + reDayabbr + '|weekdays?'
|
|
16
|
+
|
|
17
|
+
const reReltextnumber = 'first|second|third|fourth|fifth|sixth|seventh|eighth?|ninth|tenth|eleventh|twelfth'
|
|
18
|
+
const reReltexttext = 'next|last|previous|this'
|
|
19
|
+
const reReltextunit = '(?:second|sec|minute|min|hour|day|fortnight|forthnight|month|year)s?|weeks|' + reDaytext
|
|
20
|
+
|
|
21
|
+
const reYear = '([0-9]{1,4})'
|
|
22
|
+
const reYear2 = '([0-9]{2})'
|
|
23
|
+
const reYear4 = '([0-9]{4})'
|
|
24
|
+
const reYear4withSign = '([+-]?[0-9]{4})'
|
|
25
|
+
const reMonth = '(1[0-2]|0?[0-9])'
|
|
26
|
+
const reMonthlz = '(0[0-9]|1[0-2])'
|
|
27
|
+
const reDay = '(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)'
|
|
28
|
+
const reDaylz = '(0[0-9]|[1-2][0-9]|3[01])'
|
|
29
|
+
|
|
30
|
+
const reMonthFull = 'january|february|march|april|may|june|july|august|september|october|november|december'
|
|
31
|
+
const reMonthAbbr = 'jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec'
|
|
32
|
+
const reMonthroman = 'i[vx]|vi{0,3}|xi{0,2}|i{1,3}'
|
|
33
|
+
const reMonthText = '(' + reMonthFull + '|' + reMonthAbbr + '|' + reMonthroman + ')'
|
|
34
|
+
|
|
35
|
+
const reTzCorrection = '((?:GMT)?([+-])' + reHour24 + ':?' + reMinute + '?)'
|
|
36
|
+
const reTzAbbr = '\\(?([a-zA-Z]{1,6})\\)?'
|
|
37
|
+
const reDayOfYear = '(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])'
|
|
38
|
+
const reWeekOfYear = '(0[1-9]|[1-4][0-9]|5[0-3])'
|
|
39
|
+
|
|
40
|
+
const reDateNoYear = reMonthText + '[ .\\t-]*' + reDay + '[,.stndrh\\t ]*'
|
|
43
41
|
|
|
44
42
|
function processMeridian(hour, meridian) {
|
|
45
|
-
meridian = meridian && meridian.toLowerCase()
|
|
43
|
+
meridian = meridian && meridian.toLowerCase()
|
|
46
44
|
|
|
47
45
|
switch (meridian) {
|
|
48
46
|
case 'a':
|
|
49
|
-
hour += hour === 12 ? -12 : 0
|
|
50
|
-
break
|
|
47
|
+
hour += hour === 12 ? -12 : 0
|
|
48
|
+
break
|
|
51
49
|
case 'p':
|
|
52
|
-
hour += hour !== 12 ? 12 : 0
|
|
53
|
-
break
|
|
50
|
+
hour += hour !== 12 ? 12 : 0
|
|
51
|
+
break
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
return hour
|
|
54
|
+
return hour
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
function processYear(yearStr) {
|
|
60
|
-
|
|
58
|
+
let year = +yearStr
|
|
61
59
|
|
|
62
60
|
if (yearStr.length < 4 && year < 100) {
|
|
63
|
-
year += year < 70 ? 2000 : 1900
|
|
61
|
+
year += year < 70 ? 2000 : 1900
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
return year
|
|
64
|
+
return year
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
function lookupMonth(monthStr) {
|
|
@@ -103,14 +101,12 @@ function lookupMonth(monthStr) {
|
|
|
103
101
|
xi: 10,
|
|
104
102
|
dec: 11,
|
|
105
103
|
december: 11,
|
|
106
|
-
xii: 11
|
|
107
|
-
}[monthStr.toLowerCase()]
|
|
104
|
+
xii: 11,
|
|
105
|
+
}[monthStr.toLowerCase()]
|
|
108
106
|
}
|
|
109
107
|
|
|
110
|
-
function lookupWeekday(dayStr) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var dayNumbers = {
|
|
108
|
+
function lookupWeekday(dayStr, desiredSundayNumber = 0) {
|
|
109
|
+
const dayNumbers = {
|
|
114
110
|
mon: 1,
|
|
115
111
|
monday: 1,
|
|
116
112
|
tue: 2,
|
|
@@ -124,14 +120,14 @@ function lookupWeekday(dayStr) {
|
|
|
124
120
|
sat: 6,
|
|
125
121
|
saturday: 6,
|
|
126
122
|
sun: 0,
|
|
127
|
-
sunday: 0
|
|
128
|
-
}
|
|
123
|
+
sunday: 0,
|
|
124
|
+
}
|
|
129
125
|
|
|
130
|
-
return dayNumbers[dayStr.toLowerCase()] || desiredSundayNumber
|
|
126
|
+
return dayNumbers[dayStr.toLowerCase()] || desiredSundayNumber
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
function lookupRelative(relText) {
|
|
134
|
-
|
|
130
|
+
const relativeNumbers = {
|
|
135
131
|
last: -1,
|
|
136
132
|
previous: -1,
|
|
137
133
|
this: 0,
|
|
@@ -148,44 +144,44 @@ function lookupRelative(relText) {
|
|
|
148
144
|
ninth: 9,
|
|
149
145
|
tenth: 10,
|
|
150
146
|
eleventh: 11,
|
|
151
|
-
twelfth: 12
|
|
152
|
-
}
|
|
147
|
+
twelfth: 12,
|
|
148
|
+
}
|
|
153
149
|
|
|
154
|
-
|
|
155
|
-
this: 1
|
|
156
|
-
}
|
|
150
|
+
const relativeBehavior = {
|
|
151
|
+
this: 1,
|
|
152
|
+
}
|
|
157
153
|
|
|
158
|
-
|
|
154
|
+
const relTextLower = relText.toLowerCase()
|
|
159
155
|
|
|
160
156
|
return {
|
|
161
157
|
amount: relativeNumbers[relTextLower],
|
|
162
|
-
behavior: relativeBehavior[relTextLower] || 0
|
|
163
|
-
}
|
|
158
|
+
behavior: relativeBehavior[relTextLower] || 0,
|
|
159
|
+
}
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
function processTzCorrection(tzOffset, oldValue) {
|
|
167
|
-
|
|
168
|
-
tzOffset = tzOffset && tzOffset.match(reTzCorrectionLoose)
|
|
163
|
+
const reTzCorrectionLoose = /(?:GMT)?([+-])(\d+)(:?)(\d{0,2})/i
|
|
164
|
+
tzOffset = tzOffset && tzOffset.match(reTzCorrectionLoose)
|
|
169
165
|
|
|
170
166
|
if (!tzOffset) {
|
|
171
|
-
return oldValue
|
|
167
|
+
return oldValue
|
|
172
168
|
}
|
|
173
169
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
const sign = tzOffset[1] === '-' ? -1 : 1
|
|
171
|
+
let hours = +tzOffset[2]
|
|
172
|
+
let minutes = +tzOffset[4]
|
|
177
173
|
|
|
178
174
|
if (!tzOffset[4] && !tzOffset[3]) {
|
|
179
|
-
minutes = Math.floor(hours % 100)
|
|
180
|
-
hours = Math.floor(hours / 100)
|
|
175
|
+
minutes = Math.floor(hours % 100)
|
|
176
|
+
hours = Math.floor(hours / 100)
|
|
181
177
|
}
|
|
182
178
|
|
|
183
179
|
// timezone offset in seconds
|
|
184
|
-
return sign * (hours * 60 + minutes) * 60
|
|
180
|
+
return sign * (hours * 60 + minutes) * 60
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
// tz abbrevation : tz offset in seconds
|
|
188
|
-
|
|
184
|
+
const tzAbbrOffsets = {
|
|
189
185
|
acdt: 37800,
|
|
190
186
|
acst: 34200,
|
|
191
187
|
addt: -7200,
|
|
@@ -329,114 +325,129 @@ var tzAbbrOffsets = {
|
|
|
329
325
|
w: -36000,
|
|
330
326
|
x: -39600,
|
|
331
327
|
y: -43200,
|
|
332
|
-
z: 0
|
|
333
|
-
}
|
|
328
|
+
z: 0,
|
|
329
|
+
}
|
|
334
330
|
|
|
335
|
-
|
|
331
|
+
const formats = {
|
|
336
332
|
yesterday: {
|
|
337
333
|
regex: /^yesterday/i,
|
|
338
334
|
name: 'yesterday',
|
|
339
|
-
callback
|
|
340
|
-
this.rd -= 1
|
|
341
|
-
return this.resetTime()
|
|
342
|
-
}
|
|
335
|
+
callback() {
|
|
336
|
+
this.rd -= 1
|
|
337
|
+
return this.resetTime()
|
|
338
|
+
},
|
|
343
339
|
},
|
|
344
340
|
|
|
345
341
|
now: {
|
|
346
342
|
regex: /^now/i,
|
|
347
|
-
name: 'now'
|
|
343
|
+
name: 'now',
|
|
348
344
|
// do nothing
|
|
349
345
|
},
|
|
350
346
|
|
|
351
347
|
noon: {
|
|
352
348
|
regex: /^noon/i,
|
|
353
349
|
name: 'noon',
|
|
354
|
-
callback
|
|
355
|
-
return this.resetTime() && this.time(12, 0, 0, 0)
|
|
356
|
-
}
|
|
350
|
+
callback() {
|
|
351
|
+
return this.resetTime() && this.time(12, 0, 0, 0)
|
|
352
|
+
},
|
|
357
353
|
},
|
|
358
354
|
|
|
359
355
|
midnightOrToday: {
|
|
360
356
|
regex: /^(midnight|today)/i,
|
|
361
357
|
name: 'midnight | today',
|
|
362
|
-
callback
|
|
363
|
-
return this.resetTime()
|
|
364
|
-
}
|
|
358
|
+
callback() {
|
|
359
|
+
return this.resetTime()
|
|
360
|
+
},
|
|
365
361
|
},
|
|
366
362
|
|
|
367
363
|
tomorrow: {
|
|
368
364
|
regex: /^tomorrow/i,
|
|
369
365
|
name: 'tomorrow',
|
|
370
|
-
callback
|
|
371
|
-
this.rd += 1
|
|
372
|
-
return this.resetTime()
|
|
373
|
-
}
|
|
366
|
+
callback() {
|
|
367
|
+
this.rd += 1
|
|
368
|
+
return this.resetTime()
|
|
369
|
+
},
|
|
374
370
|
},
|
|
375
371
|
|
|
376
372
|
timestamp: {
|
|
377
373
|
regex: /^@(-?\d+)/i,
|
|
378
374
|
name: 'timestamp',
|
|
379
|
-
callback
|
|
380
|
-
this.rs += +timestamp
|
|
381
|
-
this.y = 1970
|
|
382
|
-
this.m = 0
|
|
383
|
-
this.d = 1
|
|
384
|
-
this.dates = 0
|
|
385
|
-
|
|
386
|
-
return this.resetTime() && this.zone(0)
|
|
387
|
-
}
|
|
375
|
+
callback(match, timestamp) {
|
|
376
|
+
this.rs += +timestamp
|
|
377
|
+
this.y = 1970
|
|
378
|
+
this.m = 0
|
|
379
|
+
this.d = 1
|
|
380
|
+
this.dates = 0
|
|
381
|
+
|
|
382
|
+
return this.resetTime() && this.zone(0)
|
|
383
|
+
},
|
|
388
384
|
},
|
|
389
385
|
|
|
390
386
|
firstOrLastDay: {
|
|
391
387
|
regex: /^(first|last) day of/i,
|
|
392
388
|
name: 'firstdayof | lastdayof',
|
|
393
|
-
callback
|
|
389
|
+
callback(match, day) {
|
|
394
390
|
if (day.toLowerCase() === 'first') {
|
|
395
|
-
this.firstOrLastDayOfMonth = 1
|
|
391
|
+
this.firstOrLastDayOfMonth = 1
|
|
396
392
|
} else {
|
|
397
|
-
this.firstOrLastDayOfMonth = -1
|
|
393
|
+
this.firstOrLastDayOfMonth = -1
|
|
398
394
|
}
|
|
399
|
-
}
|
|
395
|
+
},
|
|
400
396
|
},
|
|
401
397
|
|
|
402
398
|
backOrFrontOf: {
|
|
403
|
-
regex: RegExp('^(back|front) of ' + reHour24 + reSpaceOpt + reMeridian + '?', 'i'),
|
|
399
|
+
regex: new RegExp('^(back|front) of ' + reHour24 + reSpaceOpt + reMeridian + '?', 'i'),
|
|
404
400
|
name: 'backof | frontof',
|
|
405
|
-
callback
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
401
|
+
callback(match, side, hours, meridian) {
|
|
402
|
+
const back = side.toLowerCase() === 'back'
|
|
403
|
+
let hour = +hours
|
|
404
|
+
let minute = 15
|
|
409
405
|
|
|
410
406
|
if (!back) {
|
|
411
|
-
hour -= 1
|
|
412
|
-
minute = 45
|
|
407
|
+
hour -= 1
|
|
408
|
+
minute = 45
|
|
413
409
|
}
|
|
414
410
|
|
|
415
|
-
hour = processMeridian(hour, meridian)
|
|
411
|
+
hour = processMeridian(hour, meridian)
|
|
416
412
|
|
|
417
|
-
return this.resetTime() && this.time(hour, minute, 0, 0)
|
|
418
|
-
}
|
|
413
|
+
return this.resetTime() && this.time(hour, minute, 0, 0)
|
|
414
|
+
},
|
|
419
415
|
},
|
|
420
416
|
|
|
421
417
|
weekdayOf: {
|
|
422
|
-
regex: RegExp(
|
|
423
|
-
|
|
418
|
+
regex: new RegExp(
|
|
419
|
+
'^(' +
|
|
420
|
+
reReltextnumber +
|
|
421
|
+
'|' +
|
|
422
|
+
reReltexttext +
|
|
423
|
+
')' +
|
|
424
|
+
reSpace +
|
|
425
|
+
'(' +
|
|
426
|
+
reDayfull +
|
|
427
|
+
'|' +
|
|
428
|
+
reDayabbr +
|
|
429
|
+
')' +
|
|
430
|
+
reSpace +
|
|
431
|
+
'of',
|
|
432
|
+
'i',
|
|
433
|
+
),
|
|
434
|
+
name: 'weekdayof',
|
|
424
435
|
// todo
|
|
425
436
|
},
|
|
426
437
|
|
|
427
438
|
mssqltime: {
|
|
428
|
-
regex: RegExp('^' + reHour12 + ':' + reMinutelz + ':' + reSecondlz + '[:.]([0-9]+)' + reMeridian, 'i'),
|
|
439
|
+
regex: new RegExp('^' + reHour12 + ':' + reMinutelz + ':' + reSecondlz + '[:.]([0-9]+)' + reMeridian, 'i'),
|
|
429
440
|
name: 'mssqltime',
|
|
430
|
-
callback
|
|
431
|
-
return this.time(processMeridian(+hour, meridian), +minute, +second, +frac.substr(0, 3))
|
|
432
|
-
}
|
|
441
|
+
callback(match, hour, minute, second, frac, meridian) {
|
|
442
|
+
return this.time(processMeridian(+hour, meridian), +minute, +second, +frac.substr(0, 3))
|
|
443
|
+
},
|
|
433
444
|
},
|
|
434
445
|
|
|
435
446
|
oracledate: {
|
|
436
447
|
regex: /^(\d{2})-([A-Z]{3})-(\d{2})$/i,
|
|
437
448
|
name: 'd-M-y',
|
|
438
|
-
callback
|
|
439
|
-
|
|
449
|
+
callback(match, day, monthText, year) {
|
|
450
|
+
const month = {
|
|
440
451
|
JAN: 0,
|
|
441
452
|
FEB: 1,
|
|
442
453
|
MAR: 2,
|
|
@@ -448,363 +459,405 @@ var formats = {
|
|
|
448
459
|
SEP: 8,
|
|
449
460
|
OCT: 9,
|
|
450
461
|
NOV: 10,
|
|
451
|
-
DEC: 11
|
|
452
|
-
}[monthText.toUpperCase()]
|
|
453
|
-
return this.ymd(2000 + parseInt(year, 10), month, parseInt(day, 10))
|
|
454
|
-
}
|
|
462
|
+
DEC: 11,
|
|
463
|
+
}[monthText.toUpperCase()]
|
|
464
|
+
return this.ymd(2000 + parseInt(year, 10), month, parseInt(day, 10))
|
|
465
|
+
},
|
|
455
466
|
},
|
|
456
467
|
|
|
457
468
|
timeLong12: {
|
|
458
|
-
regex: RegExp('^' + reHour12 + '[:.]' + reMinute + '[:.]' + reSecondlz + reSpaceOpt + reMeridian, 'i'),
|
|
469
|
+
regex: new RegExp('^' + reHour12 + '[:.]' + reMinute + '[:.]' + reSecondlz + reSpaceOpt + reMeridian, 'i'),
|
|
459
470
|
name: 'timelong12',
|
|
460
|
-
callback
|
|
461
|
-
return this.time(processMeridian(+hour, meridian), +minute, +second, 0)
|
|
462
|
-
}
|
|
471
|
+
callback(match, hour, minute, second, meridian) {
|
|
472
|
+
return this.time(processMeridian(+hour, meridian), +minute, +second, 0)
|
|
473
|
+
},
|
|
463
474
|
},
|
|
464
475
|
|
|
465
476
|
timeShort12: {
|
|
466
|
-
regex: RegExp('^' + reHour12 + '[:.]' + reMinutelz + reSpaceOpt + reMeridian, 'i'),
|
|
477
|
+
regex: new RegExp('^' + reHour12 + '[:.]' + reMinutelz + reSpaceOpt + reMeridian, 'i'),
|
|
467
478
|
name: 'timeshort12',
|
|
468
|
-
callback
|
|
469
|
-
return this.time(processMeridian(+hour, meridian), +minute, 0, 0)
|
|
470
|
-
}
|
|
479
|
+
callback(match, hour, minute, meridian) {
|
|
480
|
+
return this.time(processMeridian(+hour, meridian), +minute, 0, 0)
|
|
481
|
+
},
|
|
471
482
|
},
|
|
472
483
|
|
|
473
484
|
timeTiny12: {
|
|
474
|
-
regex: RegExp('^' + reHour12 + reSpaceOpt + reMeridian, 'i'),
|
|
485
|
+
regex: new RegExp('^' + reHour12 + reSpaceOpt + reMeridian, 'i'),
|
|
475
486
|
name: 'timetiny12',
|
|
476
|
-
callback
|
|
477
|
-
return this.time(processMeridian(+hour, meridian), 0, 0, 0)
|
|
478
|
-
}
|
|
487
|
+
callback(match, hour, meridian) {
|
|
488
|
+
return this.time(processMeridian(+hour, meridian), 0, 0, 0)
|
|
489
|
+
},
|
|
479
490
|
},
|
|
480
491
|
|
|
481
492
|
soap: {
|
|
482
|
-
regex: RegExp(
|
|
493
|
+
regex: new RegExp(
|
|
494
|
+
'^' +
|
|
495
|
+
reYear4 +
|
|
496
|
+
'-' +
|
|
497
|
+
reMonthlz +
|
|
498
|
+
'-' +
|
|
499
|
+
reDaylz +
|
|
500
|
+
'T' +
|
|
501
|
+
reHour24lz +
|
|
502
|
+
':' +
|
|
503
|
+
reMinutelz +
|
|
504
|
+
':' +
|
|
505
|
+
reSecondlz +
|
|
506
|
+
reFrac +
|
|
507
|
+
reTzCorrection +
|
|
508
|
+
'?',
|
|
509
|
+
'i',
|
|
510
|
+
),
|
|
483
511
|
name: 'soap',
|
|
484
|
-
callback
|
|
485
|
-
return
|
|
486
|
-
|
|
512
|
+
callback(match, year, month, day, hour, minute, second, frac, tzCorrection) {
|
|
513
|
+
return (
|
|
514
|
+
this.ymd(+year, month - 1, +day) &&
|
|
515
|
+
this.time(+hour, +minute, +second, +frac.substr(0, 3)) &&
|
|
516
|
+
this.zone(processTzCorrection(tzCorrection))
|
|
517
|
+
)
|
|
518
|
+
},
|
|
487
519
|
},
|
|
488
520
|
|
|
489
521
|
wddx: {
|
|
490
|
-
regex: RegExp('^' + reYear4 + '-' + reMonth + '-' + reDay + 'T' + reHour24 + ':' + reMinute + ':' + reSecond),
|
|
522
|
+
regex: new RegExp('^' + reYear4 + '-' + reMonth + '-' + reDay + 'T' + reHour24 + ':' + reMinute + ':' + reSecond),
|
|
491
523
|
name: 'wddx',
|
|
492
|
-
callback
|
|
493
|
-
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
494
|
-
}
|
|
524
|
+
callback(match, year, month, day, hour, minute, second) {
|
|
525
|
+
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
526
|
+
},
|
|
495
527
|
},
|
|
496
528
|
|
|
497
529
|
exif: {
|
|
498
|
-
regex: RegExp(
|
|
530
|
+
regex: new RegExp(
|
|
531
|
+
'^' + reYear4 + ':' + reMonthlz + ':' + reDaylz + ' ' + reHour24lz + ':' + reMinutelz + ':' + reSecondlz,
|
|
532
|
+
'i',
|
|
533
|
+
),
|
|
499
534
|
name: 'exif',
|
|
500
|
-
callback
|
|
501
|
-
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
502
|
-
}
|
|
535
|
+
callback(match, year, month, day, hour, minute, second) {
|
|
536
|
+
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
537
|
+
},
|
|
503
538
|
},
|
|
504
539
|
|
|
505
540
|
xmlRpc: {
|
|
506
|
-
regex: RegExp('^' + reYear4 + reMonthlz + reDaylz + 'T' + reHour24 + ':' + reMinutelz + ':' + reSecondlz),
|
|
541
|
+
regex: new RegExp('^' + reYear4 + reMonthlz + reDaylz + 'T' + reHour24 + ':' + reMinutelz + ':' + reSecondlz),
|
|
507
542
|
name: 'xmlrpc',
|
|
508
|
-
callback
|
|
509
|
-
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
510
|
-
}
|
|
543
|
+
callback(match, year, month, day, hour, minute, second) {
|
|
544
|
+
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
545
|
+
},
|
|
511
546
|
},
|
|
512
547
|
|
|
513
548
|
xmlRpcNoColon: {
|
|
514
|
-
regex: RegExp('^' + reYear4 + reMonthlz + reDaylz + '[Tt]' + reHour24 + reMinutelz + reSecondlz),
|
|
549
|
+
regex: new RegExp('^' + reYear4 + reMonthlz + reDaylz + '[Tt]' + reHour24 + reMinutelz + reSecondlz),
|
|
515
550
|
name: 'xmlrpcnocolon',
|
|
516
|
-
callback
|
|
517
|
-
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
518
|
-
}
|
|
551
|
+
callback(match, year, month, day, hour, minute, second) {
|
|
552
|
+
return this.ymd(+year, month - 1, +day) && this.time(+hour, +minute, +second, 0)
|
|
553
|
+
},
|
|
519
554
|
},
|
|
520
555
|
|
|
521
556
|
clf: {
|
|
522
|
-
regex: RegExp(
|
|
557
|
+
regex: new RegExp(
|
|
558
|
+
'^' +
|
|
559
|
+
reDay +
|
|
560
|
+
'/(' +
|
|
561
|
+
reMonthAbbr +
|
|
562
|
+
')/' +
|
|
563
|
+
reYear4 +
|
|
564
|
+
':' +
|
|
565
|
+
reHour24lz +
|
|
566
|
+
':' +
|
|
567
|
+
reMinutelz +
|
|
568
|
+
':' +
|
|
569
|
+
reSecondlz +
|
|
570
|
+
reSpace +
|
|
571
|
+
reTzCorrection,
|
|
572
|
+
'i',
|
|
573
|
+
),
|
|
523
574
|
name: 'clf',
|
|
524
|
-
callback
|
|
525
|
-
return
|
|
526
|
-
|
|
575
|
+
callback(match, day, month, year, hour, minute, second, tzCorrection) {
|
|
576
|
+
return (
|
|
577
|
+
this.ymd(+year, lookupMonth(month), +day) &&
|
|
578
|
+
this.time(+hour, +minute, +second, 0) &&
|
|
579
|
+
this.zone(processTzCorrection(tzCorrection))
|
|
580
|
+
)
|
|
581
|
+
},
|
|
527
582
|
},
|
|
528
583
|
|
|
529
584
|
iso8601long: {
|
|
530
|
-
regex: RegExp('^t?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond + reFrac, 'i'),
|
|
585
|
+
regex: new RegExp('^t?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond + reFrac, 'i'),
|
|
531
586
|
name: 'iso8601long',
|
|
532
|
-
callback
|
|
533
|
-
return this.time(+hour, +minute, +second, +frac.substr(0, 3))
|
|
534
|
-
}
|
|
587
|
+
callback(match, hour, minute, second, frac) {
|
|
588
|
+
return this.time(+hour, +minute, +second, +frac.substr(0, 3))
|
|
589
|
+
},
|
|
535
590
|
},
|
|
536
591
|
|
|
537
592
|
dateTextual: {
|
|
538
|
-
regex: RegExp('^' + reMonthText + '[ .\\t-]*' + reDay + '[,.stndrh\\t ]+' + reYear, 'i'),
|
|
593
|
+
regex: new RegExp('^' + reMonthText + '[ .\\t-]*' + reDay + '[,.stndrh\\t ]+' + reYear, 'i'),
|
|
539
594
|
name: 'datetextual',
|
|
540
|
-
callback
|
|
541
|
-
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
542
|
-
}
|
|
595
|
+
callback(match, month, day, year) {
|
|
596
|
+
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
597
|
+
},
|
|
543
598
|
},
|
|
544
599
|
|
|
545
600
|
pointedDate4: {
|
|
546
|
-
regex: RegExp('^' + reDay + '[.\\t-]' + reMonth + '[.-]' + reYear4),
|
|
601
|
+
regex: new RegExp('^' + reDay + '[.\\t-]' + reMonth + '[.-]' + reYear4),
|
|
547
602
|
name: 'pointeddate4',
|
|
548
|
-
callback
|
|
549
|
-
return this.ymd(+year, month - 1, +day)
|
|
550
|
-
}
|
|
603
|
+
callback(match, day, month, year) {
|
|
604
|
+
return this.ymd(+year, month - 1, +day)
|
|
605
|
+
},
|
|
551
606
|
},
|
|
552
607
|
|
|
553
608
|
pointedDate2: {
|
|
554
|
-
regex: RegExp('^' + reDay + '[.\\t]' + reMonth + '\\.' + reYear2),
|
|
609
|
+
regex: new RegExp('^' + reDay + '[.\\t]' + reMonth + '\\.' + reYear2),
|
|
555
610
|
name: 'pointeddate2',
|
|
556
|
-
callback
|
|
557
|
-
return this.ymd(processYear(year), month - 1, +day)
|
|
558
|
-
}
|
|
611
|
+
callback(match, day, month, year) {
|
|
612
|
+
return this.ymd(processYear(year), month - 1, +day)
|
|
613
|
+
},
|
|
559
614
|
},
|
|
560
615
|
|
|
561
616
|
timeLong24: {
|
|
562
|
-
regex: RegExp('^t?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond),
|
|
617
|
+
regex: new RegExp('^t?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond),
|
|
563
618
|
name: 'timelong24',
|
|
564
|
-
callback
|
|
565
|
-
return this.time(+hour, +minute, +second, 0)
|
|
566
|
-
}
|
|
619
|
+
callback(match, hour, minute, second) {
|
|
620
|
+
return this.time(+hour, +minute, +second, 0)
|
|
621
|
+
},
|
|
567
622
|
},
|
|
568
623
|
|
|
569
624
|
dateNoColon: {
|
|
570
|
-
regex: RegExp('^' + reYear4 + reMonthlz + reDaylz),
|
|
625
|
+
regex: new RegExp('^' + reYear4 + reMonthlz + reDaylz),
|
|
571
626
|
name: 'datenocolon',
|
|
572
|
-
callback
|
|
573
|
-
return this.ymd(+year, month - 1, +day)
|
|
574
|
-
}
|
|
627
|
+
callback(match, year, month, day) {
|
|
628
|
+
return this.ymd(+year, month - 1, +day)
|
|
629
|
+
},
|
|
575
630
|
},
|
|
576
631
|
|
|
577
632
|
pgydotd: {
|
|
578
|
-
regex: RegExp('^' + reYear4 + '\\.?' + reDayOfYear),
|
|
633
|
+
regex: new RegExp('^' + reYear4 + '\\.?' + reDayOfYear),
|
|
579
634
|
name: 'pgydotd',
|
|
580
|
-
callback
|
|
581
|
-
return this.ymd(+year, 0, +day)
|
|
582
|
-
}
|
|
635
|
+
callback(match, year, day) {
|
|
636
|
+
return this.ymd(+year, 0, +day)
|
|
637
|
+
},
|
|
583
638
|
},
|
|
584
639
|
|
|
585
640
|
timeShort24: {
|
|
586
|
-
regex: RegExp('^t?' + reHour24 + '[:.]' + reMinute, 'i'),
|
|
641
|
+
regex: new RegExp('^t?' + reHour24 + '[:.]' + reMinute, 'i'),
|
|
587
642
|
name: 'timeshort24',
|
|
588
|
-
callback
|
|
589
|
-
return this.time(+hour, +minute, 0, 0)
|
|
590
|
-
}
|
|
643
|
+
callback(match, hour, minute) {
|
|
644
|
+
return this.time(+hour, +minute, 0, 0)
|
|
645
|
+
},
|
|
591
646
|
},
|
|
592
647
|
|
|
593
648
|
iso8601noColon: {
|
|
594
|
-
regex: RegExp('^t?' + reHour24lz + reMinutelz + reSecondlz, 'i'),
|
|
649
|
+
regex: new RegExp('^t?' + reHour24lz + reMinutelz + reSecondlz, 'i'),
|
|
595
650
|
name: 'iso8601nocolon',
|
|
596
|
-
callback
|
|
597
|
-
return this.time(+hour, +minute, +second, 0)
|
|
598
|
-
}
|
|
651
|
+
callback(match, hour, minute, second) {
|
|
652
|
+
return this.time(+hour, +minute, +second, 0)
|
|
653
|
+
},
|
|
599
654
|
},
|
|
600
655
|
|
|
601
656
|
iso8601dateSlash: {
|
|
602
657
|
// eventhough the trailing slash is optional in PHP
|
|
603
658
|
// here it's mandatory and inputs without the slash
|
|
604
659
|
// are handled by dateslash
|
|
605
|
-
regex: RegExp('^' + reYear4 + '/' + reMonthlz + '/' + reDaylz + '/'),
|
|
660
|
+
regex: new RegExp('^' + reYear4 + '/' + reMonthlz + '/' + reDaylz + '/'),
|
|
606
661
|
name: 'iso8601dateslash',
|
|
607
|
-
callback
|
|
608
|
-
return this.ymd(+year, month - 1, +day)
|
|
609
|
-
}
|
|
662
|
+
callback(match, year, month, day) {
|
|
663
|
+
return this.ymd(+year, month - 1, +day)
|
|
664
|
+
},
|
|
610
665
|
},
|
|
611
666
|
|
|
612
667
|
dateSlash: {
|
|
613
|
-
regex: RegExp('^' + reYear4 + '/' + reMonth + '/' + reDay),
|
|
668
|
+
regex: new RegExp('^' + reYear4 + '/' + reMonth + '/' + reDay),
|
|
614
669
|
name: 'dateslash',
|
|
615
|
-
callback
|
|
616
|
-
return this.ymd(+year, month - 1, +day)
|
|
617
|
-
}
|
|
670
|
+
callback(match, year, month, day) {
|
|
671
|
+
return this.ymd(+year, month - 1, +day)
|
|
672
|
+
},
|
|
618
673
|
},
|
|
619
674
|
|
|
620
675
|
american: {
|
|
621
|
-
regex: RegExp('^' + reMonth + '/' + reDay + '/' + reYear),
|
|
676
|
+
regex: new RegExp('^' + reMonth + '/' + reDay + '/' + reYear),
|
|
622
677
|
name: 'american',
|
|
623
|
-
callback
|
|
624
|
-
return this.ymd(processYear(year), month - 1, +day)
|
|
625
|
-
}
|
|
678
|
+
callback(match, month, day, year) {
|
|
679
|
+
return this.ymd(processYear(year), month - 1, +day)
|
|
680
|
+
},
|
|
626
681
|
},
|
|
627
682
|
|
|
628
683
|
americanShort: {
|
|
629
|
-
regex: RegExp('^' + reMonth + '/' + reDay),
|
|
684
|
+
regex: new RegExp('^' + reMonth + '/' + reDay),
|
|
630
685
|
name: 'americanshort',
|
|
631
|
-
callback
|
|
632
|
-
return this.ymd(this.y, month - 1, +day)
|
|
633
|
-
}
|
|
686
|
+
callback(match, month, day) {
|
|
687
|
+
return this.ymd(this.y, month - 1, +day)
|
|
688
|
+
},
|
|
634
689
|
},
|
|
635
690
|
|
|
636
691
|
gnuDateShortOrIso8601date2: {
|
|
637
692
|
// iso8601date2 is complete subset of gnudateshort
|
|
638
|
-
regex: RegExp('^' + reYear + '-' + reMonth + '-' + reDay),
|
|
693
|
+
regex: new RegExp('^' + reYear + '-' + reMonth + '-' + reDay),
|
|
639
694
|
name: 'gnudateshort | iso8601date2',
|
|
640
|
-
callback
|
|
641
|
-
return this.ymd(processYear(year), month - 1, +day)
|
|
642
|
-
}
|
|
695
|
+
callback(match, year, month, day) {
|
|
696
|
+
return this.ymd(processYear(year), month - 1, +day)
|
|
697
|
+
},
|
|
643
698
|
},
|
|
644
699
|
|
|
645
700
|
iso8601date4: {
|
|
646
|
-
regex: RegExp('^' + reYear4withSign + '-' + reMonthlz + '-' + reDaylz),
|
|
701
|
+
regex: new RegExp('^' + reYear4withSign + '-' + reMonthlz + '-' + reDaylz),
|
|
647
702
|
name: 'iso8601date4',
|
|
648
|
-
callback
|
|
649
|
-
return this.ymd(+year, month - 1, +day)
|
|
650
|
-
}
|
|
703
|
+
callback(match, year, month, day) {
|
|
704
|
+
return this.ymd(+year, month - 1, +day)
|
|
705
|
+
},
|
|
651
706
|
},
|
|
652
707
|
|
|
653
708
|
gnuNoColon: {
|
|
654
|
-
regex: RegExp('^t?' + reHour24lz + reMinutelz, 'i'),
|
|
709
|
+
regex: new RegExp('^t?' + reHour24lz + reMinutelz, 'i'),
|
|
655
710
|
name: 'gnunocolon',
|
|
656
|
-
callback
|
|
711
|
+
callback(match, hour, minute) {
|
|
657
712
|
// this rule is a special case
|
|
658
713
|
// if time was already set once by any preceding rule, it sets the captured value as year
|
|
659
714
|
switch (this.times) {
|
|
660
715
|
case 0:
|
|
661
|
-
return this.time(+hour, +minute, 0, this.f)
|
|
716
|
+
return this.time(+hour, +minute, 0, this.f)
|
|
662
717
|
case 1:
|
|
663
|
-
this.y = hour * 100 + +minute
|
|
664
|
-
this.times
|
|
718
|
+
this.y = hour * 100 + +minute
|
|
719
|
+
this.times++
|
|
665
720
|
|
|
666
|
-
return true
|
|
721
|
+
return true
|
|
667
722
|
default:
|
|
668
|
-
return false
|
|
723
|
+
return false
|
|
669
724
|
}
|
|
670
|
-
}
|
|
725
|
+
},
|
|
671
726
|
},
|
|
672
727
|
|
|
673
728
|
gnuDateShorter: {
|
|
674
|
-
regex: RegExp('^' + reYear4 + '-' + reMonth),
|
|
729
|
+
regex: new RegExp('^' + reYear4 + '-' + reMonth),
|
|
675
730
|
name: 'gnudateshorter',
|
|
676
|
-
callback
|
|
677
|
-
return this.ymd(+year, month - 1, 1)
|
|
678
|
-
}
|
|
731
|
+
callback(match, year, month) {
|
|
732
|
+
return this.ymd(+year, month - 1, 1)
|
|
733
|
+
},
|
|
679
734
|
},
|
|
680
735
|
|
|
681
736
|
pgTextReverse: {
|
|
682
|
-
//
|
|
737
|
+
// note: allowed years are from 32-9999
|
|
683
738
|
// years below 32 should be treated as days in datefull
|
|
684
|
-
regex: RegExp('^' + '(\\d{3,4}|[4-9]\\d|3[2-9])-(' + reMonthAbbr + ')-' + reDaylz, 'i'),
|
|
739
|
+
regex: new RegExp('^' + '(\\d{3,4}|[4-9]\\d|3[2-9])-(' + reMonthAbbr + ')-' + reDaylz, 'i'),
|
|
685
740
|
name: 'pgtextreverse',
|
|
686
|
-
callback
|
|
687
|
-
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
688
|
-
}
|
|
741
|
+
callback(match, year, month, day) {
|
|
742
|
+
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
743
|
+
},
|
|
689
744
|
},
|
|
690
745
|
|
|
691
746
|
dateFull: {
|
|
692
|
-
regex: RegExp('^' + reDay + '[ \\t.-]*' + reMonthText + '[ \\t.-]*' + reYear, 'i'),
|
|
747
|
+
regex: new RegExp('^' + reDay + '[ \\t.-]*' + reMonthText + '[ \\t.-]*' + reYear, 'i'),
|
|
693
748
|
name: 'datefull',
|
|
694
|
-
callback
|
|
695
|
-
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
696
|
-
}
|
|
749
|
+
callback(match, day, month, year) {
|
|
750
|
+
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
751
|
+
},
|
|
697
752
|
},
|
|
698
753
|
|
|
699
754
|
dateNoDay: {
|
|
700
|
-
regex: RegExp('^' + reMonthText + '[ .\\t-]*' + reYear4, 'i'),
|
|
755
|
+
regex: new RegExp('^' + reMonthText + '[ .\\t-]*' + reYear4, 'i'),
|
|
701
756
|
name: 'datenoday',
|
|
702
|
-
callback
|
|
703
|
-
return this.ymd(+year, lookupMonth(month), 1)
|
|
704
|
-
}
|
|
757
|
+
callback(match, month, year) {
|
|
758
|
+
return this.ymd(+year, lookupMonth(month), 1)
|
|
759
|
+
},
|
|
705
760
|
},
|
|
706
761
|
|
|
707
762
|
dateNoDayRev: {
|
|
708
|
-
regex: RegExp('^' + reYear4 + '[ .\\t-]*' + reMonthText, 'i'),
|
|
763
|
+
regex: new RegExp('^' + reYear4 + '[ .\\t-]*' + reMonthText, 'i'),
|
|
709
764
|
name: 'datenodayrev',
|
|
710
|
-
callback
|
|
711
|
-
return this.ymd(+year, lookupMonth(month), 1)
|
|
712
|
-
}
|
|
765
|
+
callback(match, year, month) {
|
|
766
|
+
return this.ymd(+year, lookupMonth(month), 1)
|
|
767
|
+
},
|
|
713
768
|
},
|
|
714
769
|
|
|
715
770
|
pgTextShort: {
|
|
716
|
-
regex: RegExp('^(' + reMonthAbbr + ')-' + reDaylz + '-' + reYear, 'i'),
|
|
771
|
+
regex: new RegExp('^(' + reMonthAbbr + ')-' + reDaylz + '-' + reYear, 'i'),
|
|
717
772
|
name: 'pgtextshort',
|
|
718
|
-
callback
|
|
719
|
-
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
720
|
-
}
|
|
773
|
+
callback(match, month, day, year) {
|
|
774
|
+
return this.ymd(processYear(year), lookupMonth(month), +day)
|
|
775
|
+
},
|
|
721
776
|
},
|
|
722
777
|
|
|
723
778
|
dateNoYear: {
|
|
724
|
-
regex: RegExp('^' + reDateNoYear, 'i'),
|
|
779
|
+
regex: new RegExp('^' + reDateNoYear, 'i'),
|
|
725
780
|
name: 'datenoyear',
|
|
726
|
-
callback
|
|
727
|
-
return this.ymd(this.y, lookupMonth(month), +day)
|
|
728
|
-
}
|
|
781
|
+
callback(match, month, day) {
|
|
782
|
+
return this.ymd(this.y, lookupMonth(month), +day)
|
|
783
|
+
},
|
|
729
784
|
},
|
|
730
785
|
|
|
731
786
|
dateNoYearRev: {
|
|
732
|
-
regex: RegExp('^' + reDay + '[ .\\t-]*' + reMonthText, 'i'),
|
|
787
|
+
regex: new RegExp('^' + reDay + '[ .\\t-]*' + reMonthText, 'i'),
|
|
733
788
|
name: 'datenoyearrev',
|
|
734
|
-
callback
|
|
735
|
-
return this.ymd(this.y, lookupMonth(month), +day)
|
|
736
|
-
}
|
|
789
|
+
callback(match, day, month) {
|
|
790
|
+
return this.ymd(this.y, lookupMonth(month), +day)
|
|
791
|
+
},
|
|
737
792
|
},
|
|
738
793
|
|
|
739
794
|
isoWeekDay: {
|
|
740
|
-
regex: RegExp('^' + reYear4 + '-?W' + reWeekOfYear + '(?:-?([0-7]))?'),
|
|
795
|
+
regex: new RegExp('^' + reYear4 + '-?W' + reWeekOfYear + '(?:-?([0-7]))?'),
|
|
741
796
|
name: 'isoweekday | isoweek',
|
|
742
|
-
callback
|
|
743
|
-
day = day ? +day : 1
|
|
797
|
+
callback(match, year, week, day) {
|
|
798
|
+
day = day ? +day : 1
|
|
744
799
|
|
|
745
800
|
if (!this.ymd(+year, 0, 1)) {
|
|
746
|
-
return false
|
|
801
|
+
return false
|
|
747
802
|
}
|
|
748
803
|
|
|
749
804
|
// get day of week for Jan 1st
|
|
750
|
-
|
|
805
|
+
let dayOfWeek = new Date(this.y, this.m, this.d).getDay()
|
|
751
806
|
|
|
752
807
|
// and use the day to figure out the offset for day 1 of week 1
|
|
753
|
-
dayOfWeek = 0 - (dayOfWeek > 4 ? dayOfWeek - 7 : dayOfWeek)
|
|
808
|
+
dayOfWeek = 0 - (dayOfWeek > 4 ? dayOfWeek - 7 : dayOfWeek)
|
|
754
809
|
|
|
755
|
-
this.rd += dayOfWeek + (week - 1) * 7 + day
|
|
756
|
-
}
|
|
810
|
+
this.rd += dayOfWeek + (week - 1) * 7 + day
|
|
811
|
+
},
|
|
757
812
|
},
|
|
758
813
|
|
|
759
814
|
relativeText: {
|
|
760
|
-
regex: RegExp('^(' + reReltextnumber + '|' + reReltexttext + ')' + reSpace + '(' + reReltextunit + ')', 'i'),
|
|
815
|
+
regex: new RegExp('^(' + reReltextnumber + '|' + reReltexttext + ')' + reSpace + '(' + reReltextunit + ')', 'i'),
|
|
761
816
|
name: 'relativetext',
|
|
762
|
-
callback
|
|
817
|
+
callback(match, relValue, relUnit) {
|
|
763
818
|
// todo: implement handling of 'this time-unit'
|
|
764
|
-
//
|
|
765
|
-
|
|
766
|
-
amount = _lookupRelative.amount,
|
|
767
|
-
behavior = _lookupRelative.behavior;
|
|
819
|
+
// biome-ignore lint/correctness/noUnusedVariables: behavior reserved for future use
|
|
820
|
+
const { amount, behavior } = lookupRelative(relValue)
|
|
768
821
|
|
|
769
822
|
switch (relUnit.toLowerCase()) {
|
|
770
823
|
case 'sec':
|
|
771
824
|
case 'secs':
|
|
772
825
|
case 'second':
|
|
773
826
|
case 'seconds':
|
|
774
|
-
this.rs += amount
|
|
775
|
-
break
|
|
827
|
+
this.rs += amount
|
|
828
|
+
break
|
|
776
829
|
case 'min':
|
|
777
830
|
case 'mins':
|
|
778
831
|
case 'minute':
|
|
779
832
|
case 'minutes':
|
|
780
|
-
this.ri += amount
|
|
781
|
-
break
|
|
833
|
+
this.ri += amount
|
|
834
|
+
break
|
|
782
835
|
case 'hour':
|
|
783
836
|
case 'hours':
|
|
784
|
-
this.rh += amount
|
|
785
|
-
break
|
|
837
|
+
this.rh += amount
|
|
838
|
+
break
|
|
786
839
|
case 'day':
|
|
787
840
|
case 'days':
|
|
788
|
-
this.rd += amount
|
|
789
|
-
break
|
|
841
|
+
this.rd += amount
|
|
842
|
+
break
|
|
790
843
|
case 'fortnight':
|
|
791
844
|
case 'fortnights':
|
|
792
845
|
case 'forthnight':
|
|
793
846
|
case 'forthnights':
|
|
794
|
-
this.rd += amount * 14
|
|
795
|
-
break
|
|
847
|
+
this.rd += amount * 14
|
|
848
|
+
break
|
|
796
849
|
case 'week':
|
|
797
850
|
case 'weeks':
|
|
798
|
-
this.rd += amount * 7
|
|
799
|
-
break
|
|
851
|
+
this.rd += amount * 7
|
|
852
|
+
break
|
|
800
853
|
case 'month':
|
|
801
854
|
case 'months':
|
|
802
|
-
this.rm += amount
|
|
803
|
-
break
|
|
855
|
+
this.rm += amount
|
|
856
|
+
break
|
|
804
857
|
case 'year':
|
|
805
858
|
case 'years':
|
|
806
|
-
this.ry += amount
|
|
807
|
-
break
|
|
859
|
+
this.ry += amount
|
|
860
|
+
break
|
|
808
861
|
case 'mon':
|
|
809
862
|
case 'monday':
|
|
810
863
|
case 'tue':
|
|
@@ -819,66 +872,66 @@ var formats = {
|
|
|
819
872
|
case 'saturday':
|
|
820
873
|
case 'sun':
|
|
821
874
|
case 'sunday':
|
|
822
|
-
this.resetTime()
|
|
823
|
-
this.weekday = lookupWeekday(relUnit, 7)
|
|
824
|
-
this.weekdayBehavior = 1
|
|
825
|
-
this.rd += (amount > 0 ? amount - 1 : amount) * 7
|
|
826
|
-
break
|
|
875
|
+
this.resetTime()
|
|
876
|
+
this.weekday = lookupWeekday(relUnit, 7)
|
|
877
|
+
this.weekdayBehavior = 1
|
|
878
|
+
this.rd += (amount > 0 ? amount - 1 : amount) * 7
|
|
879
|
+
break
|
|
827
880
|
case 'weekday':
|
|
828
881
|
case 'weekdays':
|
|
829
882
|
// todo
|
|
830
|
-
break
|
|
883
|
+
break
|
|
831
884
|
}
|
|
832
|
-
}
|
|
885
|
+
},
|
|
833
886
|
},
|
|
834
887
|
|
|
835
888
|
relative: {
|
|
836
|
-
regex: RegExp('^([+-]*)[ \\t]*(\\d+)' + reSpaceOpt + '(' + reReltextunit + '|week)', 'i'),
|
|
889
|
+
regex: new RegExp('^([+-]*)[ \\t]*(\\d+)' + reSpaceOpt + '(' + reReltextunit + '|week)', 'i'),
|
|
837
890
|
name: 'relative',
|
|
838
|
-
callback
|
|
839
|
-
|
|
891
|
+
callback(match, signs, relValue, relUnit) {
|
|
892
|
+
const minuses = signs.replace(/[^-]/g, '').length
|
|
840
893
|
|
|
841
|
-
|
|
894
|
+
const amount = +relValue * Math.pow(-1, minuses)
|
|
842
895
|
|
|
843
896
|
switch (relUnit.toLowerCase()) {
|
|
844
897
|
case 'sec':
|
|
845
898
|
case 'secs':
|
|
846
899
|
case 'second':
|
|
847
900
|
case 'seconds':
|
|
848
|
-
this.rs += amount
|
|
849
|
-
break
|
|
901
|
+
this.rs += amount
|
|
902
|
+
break
|
|
850
903
|
case 'min':
|
|
851
904
|
case 'mins':
|
|
852
905
|
case 'minute':
|
|
853
906
|
case 'minutes':
|
|
854
|
-
this.ri += amount
|
|
855
|
-
break
|
|
907
|
+
this.ri += amount
|
|
908
|
+
break
|
|
856
909
|
case 'hour':
|
|
857
910
|
case 'hours':
|
|
858
|
-
this.rh += amount
|
|
859
|
-
break
|
|
911
|
+
this.rh += amount
|
|
912
|
+
break
|
|
860
913
|
case 'day':
|
|
861
914
|
case 'days':
|
|
862
|
-
this.rd += amount
|
|
863
|
-
break
|
|
915
|
+
this.rd += amount
|
|
916
|
+
break
|
|
864
917
|
case 'fortnight':
|
|
865
918
|
case 'fortnights':
|
|
866
919
|
case 'forthnight':
|
|
867
920
|
case 'forthnights':
|
|
868
|
-
this.rd += amount * 14
|
|
869
|
-
break
|
|
921
|
+
this.rd += amount * 14
|
|
922
|
+
break
|
|
870
923
|
case 'week':
|
|
871
924
|
case 'weeks':
|
|
872
|
-
this.rd += amount * 7
|
|
873
|
-
break
|
|
925
|
+
this.rd += amount * 7
|
|
926
|
+
break
|
|
874
927
|
case 'month':
|
|
875
928
|
case 'months':
|
|
876
|
-
this.rm += amount
|
|
877
|
-
break
|
|
929
|
+
this.rm += amount
|
|
930
|
+
break
|
|
878
931
|
case 'year':
|
|
879
932
|
case 'years':
|
|
880
|
-
this.ry += amount
|
|
881
|
-
break
|
|
933
|
+
this.ry += amount
|
|
934
|
+
break
|
|
882
935
|
case 'mon':
|
|
883
936
|
case 'monday':
|
|
884
937
|
case 'tue':
|
|
@@ -893,150 +946,155 @@ var formats = {
|
|
|
893
946
|
case 'saturday':
|
|
894
947
|
case 'sun':
|
|
895
948
|
case 'sunday':
|
|
896
|
-
this.resetTime()
|
|
897
|
-
this.weekday = lookupWeekday(relUnit, 7)
|
|
898
|
-
this.weekdayBehavior = 1
|
|
899
|
-
this.rd += (amount > 0 ? amount - 1 : amount) * 7
|
|
900
|
-
break
|
|
949
|
+
this.resetTime()
|
|
950
|
+
this.weekday = lookupWeekday(relUnit, 7)
|
|
951
|
+
this.weekdayBehavior = 1
|
|
952
|
+
this.rd += (amount > 0 ? amount - 1 : amount) * 7
|
|
953
|
+
break
|
|
901
954
|
case 'weekday':
|
|
902
955
|
case 'weekdays':
|
|
903
956
|
// todo
|
|
904
|
-
break
|
|
957
|
+
break
|
|
905
958
|
}
|
|
906
|
-
}
|
|
959
|
+
},
|
|
907
960
|
},
|
|
908
961
|
|
|
909
962
|
dayText: {
|
|
910
|
-
regex: RegExp('^(' + reDaytext + ')', 'i'),
|
|
963
|
+
regex: new RegExp('^(' + reDaytext + ')', 'i'),
|
|
911
964
|
name: 'daytext',
|
|
912
|
-
callback
|
|
913
|
-
this.resetTime()
|
|
914
|
-
this.weekday = lookupWeekday(dayText, 0)
|
|
965
|
+
callback(match, dayText) {
|
|
966
|
+
this.resetTime()
|
|
967
|
+
this.weekday = lookupWeekday(dayText, 0)
|
|
915
968
|
|
|
916
969
|
if (this.weekdayBehavior !== 2) {
|
|
917
|
-
this.weekdayBehavior = 1
|
|
970
|
+
this.weekdayBehavior = 1
|
|
918
971
|
}
|
|
919
|
-
}
|
|
972
|
+
},
|
|
920
973
|
},
|
|
921
974
|
|
|
922
975
|
relativeTextWeek: {
|
|
923
|
-
regex: RegExp('^(' + reReltexttext + ')' + reSpace + 'week', 'i'),
|
|
976
|
+
regex: new RegExp('^(' + reReltexttext + ')' + reSpace + 'week', 'i'),
|
|
924
977
|
name: 'relativetextweek',
|
|
925
|
-
callback
|
|
926
|
-
this.weekdayBehavior = 2
|
|
978
|
+
callback(match, relText) {
|
|
979
|
+
this.weekdayBehavior = 2
|
|
927
980
|
|
|
928
981
|
switch (relText.toLowerCase()) {
|
|
929
982
|
case 'this':
|
|
930
|
-
this.rd += 0
|
|
931
|
-
break
|
|
983
|
+
this.rd += 0
|
|
984
|
+
break
|
|
932
985
|
case 'next':
|
|
933
|
-
this.rd += 7
|
|
934
|
-
break
|
|
986
|
+
this.rd += 7
|
|
987
|
+
break
|
|
935
988
|
case 'last':
|
|
936
989
|
case 'previous':
|
|
937
|
-
this.rd -= 7
|
|
938
|
-
break
|
|
990
|
+
this.rd -= 7
|
|
991
|
+
break
|
|
939
992
|
}
|
|
940
993
|
|
|
941
994
|
if (isNaN(this.weekday)) {
|
|
942
|
-
this.weekday = 1
|
|
995
|
+
this.weekday = 1
|
|
943
996
|
}
|
|
944
|
-
}
|
|
997
|
+
},
|
|
945
998
|
},
|
|
946
999
|
|
|
947
1000
|
monthFullOrMonthAbbr: {
|
|
948
|
-
regex: RegExp('^(' + reMonthFull + '|' + reMonthAbbr + ')', 'i'),
|
|
1001
|
+
regex: new RegExp('^(' + reMonthFull + '|' + reMonthAbbr + ')', 'i'),
|
|
949
1002
|
name: 'monthfull | monthabbr',
|
|
950
|
-
callback
|
|
951
|
-
return this.ymd(this.y, lookupMonth(month), this.d)
|
|
952
|
-
}
|
|
1003
|
+
callback(match, month) {
|
|
1004
|
+
return this.ymd(this.y, lookupMonth(month), this.d)
|
|
1005
|
+
},
|
|
953
1006
|
},
|
|
954
1007
|
|
|
955
1008
|
tzCorrection: {
|
|
956
|
-
regex: RegExp('^' + reTzCorrection, 'i'),
|
|
1009
|
+
regex: new RegExp('^' + reTzCorrection, 'i'),
|
|
957
1010
|
name: 'tzcorrection',
|
|
958
|
-
callback
|
|
959
|
-
return this.zone(processTzCorrection(tzCorrection))
|
|
960
|
-
}
|
|
1011
|
+
callback(tzCorrection) {
|
|
1012
|
+
return this.zone(processTzCorrection(tzCorrection))
|
|
1013
|
+
},
|
|
961
1014
|
},
|
|
962
1015
|
|
|
963
1016
|
tzAbbr: {
|
|
964
|
-
regex: RegExp('^' + reTzAbbr),
|
|
1017
|
+
regex: new RegExp('^' + reTzAbbr),
|
|
965
1018
|
name: 'tzabbr',
|
|
966
|
-
callback
|
|
967
|
-
|
|
1019
|
+
callback(match, abbr) {
|
|
1020
|
+
const offset = tzAbbrOffsets[abbr.toLowerCase()]
|
|
968
1021
|
|
|
969
1022
|
if (isNaN(offset)) {
|
|
970
|
-
return false
|
|
1023
|
+
return false
|
|
971
1024
|
}
|
|
972
1025
|
|
|
973
|
-
return this.zone(offset)
|
|
974
|
-
}
|
|
1026
|
+
return this.zone(offset)
|
|
1027
|
+
},
|
|
975
1028
|
},
|
|
976
1029
|
|
|
977
1030
|
ago: {
|
|
978
1031
|
regex: /^ago/i,
|
|
979
1032
|
name: 'ago',
|
|
980
|
-
callback
|
|
981
|
-
this.ry = -this.ry
|
|
982
|
-
this.rm = -this.rm
|
|
983
|
-
this.rd = -this.rd
|
|
984
|
-
this.rh = -this.rh
|
|
985
|
-
this.ri = -this.ri
|
|
986
|
-
this.rs = -this.rs
|
|
987
|
-
this.rf = -this.rf
|
|
988
|
-
}
|
|
1033
|
+
callback() {
|
|
1034
|
+
this.ry = -this.ry
|
|
1035
|
+
this.rm = -this.rm
|
|
1036
|
+
this.rd = -this.rd
|
|
1037
|
+
this.rh = -this.rh
|
|
1038
|
+
this.ri = -this.ri
|
|
1039
|
+
this.rs = -this.rs
|
|
1040
|
+
this.rf = -this.rf
|
|
1041
|
+
},
|
|
989
1042
|
},
|
|
990
1043
|
|
|
991
1044
|
year4: {
|
|
992
|
-
regex: RegExp('^' + reYear4),
|
|
1045
|
+
regex: new RegExp('^' + reYear4),
|
|
993
1046
|
name: 'year4',
|
|
994
|
-
callback
|
|
995
|
-
this.y = +year
|
|
996
|
-
return true
|
|
997
|
-
}
|
|
1047
|
+
callback(match, year) {
|
|
1048
|
+
this.y = +year
|
|
1049
|
+
return true
|
|
1050
|
+
},
|
|
998
1051
|
},
|
|
999
1052
|
|
|
1000
1053
|
whitespace: {
|
|
1001
1054
|
regex: /^[ .,\t]+/,
|
|
1002
|
-
name: 'whitespace'
|
|
1055
|
+
name: 'whitespace',
|
|
1003
1056
|
// do nothing
|
|
1004
1057
|
},
|
|
1005
1058
|
|
|
1006
1059
|
dateShortWithTimeLong: {
|
|
1007
|
-
regex: RegExp('^' + reDateNoYear + 't?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond, 'i'),
|
|
1060
|
+
regex: new RegExp('^' + reDateNoYear + 't?' + reHour24 + '[:.]' + reMinute + '[:.]' + reSecond, 'i'),
|
|
1008
1061
|
name: 'dateshortwithtimelong',
|
|
1009
|
-
callback
|
|
1010
|
-
return this.ymd(this.y, lookupMonth(month), +day) && this.time(+hour, +minute, +second, 0)
|
|
1011
|
-
}
|
|
1062
|
+
callback(match, month, day, hour, minute, second) {
|
|
1063
|
+
return this.ymd(this.y, lookupMonth(month), +day) && this.time(+hour, +minute, +second, 0)
|
|
1064
|
+
},
|
|
1012
1065
|
},
|
|
1013
1066
|
|
|
1014
1067
|
dateShortWithTimeLong12: {
|
|
1015
|
-
regex: RegExp(
|
|
1068
|
+
regex: new RegExp(
|
|
1069
|
+
'^' + reDateNoYear + reHour12 + '[:.]' + reMinute + '[:.]' + reSecondlz + reSpaceOpt + reMeridian,
|
|
1070
|
+
'i',
|
|
1071
|
+
),
|
|
1016
1072
|
name: 'dateshortwithtimelong12',
|
|
1017
|
-
callback
|
|
1018
|
-
return
|
|
1019
|
-
|
|
1073
|
+
callback(match, month, day, hour, minute, second, meridian) {
|
|
1074
|
+
return (
|
|
1075
|
+
this.ymd(this.y, lookupMonth(month), +day) && this.time(processMeridian(+hour, meridian), +minute, +second, 0)
|
|
1076
|
+
)
|
|
1077
|
+
},
|
|
1020
1078
|
},
|
|
1021
1079
|
|
|
1022
1080
|
dateShortWithTimeShort: {
|
|
1023
|
-
regex: RegExp('^' + reDateNoYear + 't?' + reHour24 + '[:.]' + reMinute, 'i'),
|
|
1081
|
+
regex: new RegExp('^' + reDateNoYear + 't?' + reHour24 + '[:.]' + reMinute, 'i'),
|
|
1024
1082
|
name: 'dateshortwithtimeshort',
|
|
1025
|
-
callback
|
|
1026
|
-
return this.ymd(this.y, lookupMonth(month), +day) && this.time(+hour, +minute, 0, 0)
|
|
1027
|
-
}
|
|
1083
|
+
callback(match, month, day, hour, minute) {
|
|
1084
|
+
return this.ymd(this.y, lookupMonth(month), +day) && this.time(+hour, +minute, 0, 0)
|
|
1085
|
+
},
|
|
1028
1086
|
},
|
|
1029
1087
|
|
|
1030
1088
|
dateShortWithTimeShort12: {
|
|
1031
|
-
regex: RegExp('^' + reDateNoYear + reHour12 + '[:.]' + reMinutelz + reSpaceOpt + reMeridian, 'i'),
|
|
1089
|
+
regex: new RegExp('^' + reDateNoYear + reHour12 + '[:.]' + reMinutelz + reSpaceOpt + reMeridian, 'i'),
|
|
1032
1090
|
name: 'dateshortwithtimeshort12',
|
|
1033
|
-
callback
|
|
1034
|
-
return this.ymd(this.y, lookupMonth(month), +day) && this.time(processMeridian(+hour, meridian), +minute, 0, 0)
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1091
|
+
callback(match, month, day, hour, minute, meridian) {
|
|
1092
|
+
return this.ymd(this.y, lookupMonth(month), +day) && this.time(processMeridian(+hour, meridian), +minute, 0, 0)
|
|
1093
|
+
},
|
|
1094
|
+
},
|
|
1095
|
+
}
|
|
1038
1096
|
|
|
1039
|
-
|
|
1097
|
+
const resultProto = {
|
|
1040
1098
|
// date
|
|
1041
1099
|
y: NaN,
|
|
1042
1100
|
m: NaN,
|
|
@@ -1073,174 +1131,178 @@ var resultProto = {
|
|
|
1073
1131
|
zones: 0,
|
|
1074
1132
|
|
|
1075
1133
|
// helper functions
|
|
1076
|
-
ymd
|
|
1134
|
+
ymd(y, m, d) {
|
|
1077
1135
|
if (this.dates > 0) {
|
|
1078
|
-
return false
|
|
1136
|
+
return false
|
|
1079
1137
|
}
|
|
1080
1138
|
|
|
1081
|
-
this.dates
|
|
1082
|
-
this.y = y
|
|
1083
|
-
this.m = m
|
|
1084
|
-
this.d = d
|
|
1085
|
-
return true
|
|
1139
|
+
this.dates++
|
|
1140
|
+
this.y = y
|
|
1141
|
+
this.m = m
|
|
1142
|
+
this.d = d
|
|
1143
|
+
return true
|
|
1086
1144
|
},
|
|
1087
|
-
|
|
1145
|
+
|
|
1146
|
+
time(h, i, s, f) {
|
|
1088
1147
|
if (this.times > 0) {
|
|
1089
|
-
return false
|
|
1148
|
+
return false
|
|
1090
1149
|
}
|
|
1091
1150
|
|
|
1092
|
-
this.times
|
|
1093
|
-
this.h = h
|
|
1094
|
-
this.i = i
|
|
1095
|
-
this.s = s
|
|
1096
|
-
this.f = f
|
|
1151
|
+
this.times++
|
|
1152
|
+
this.h = h
|
|
1153
|
+
this.i = i
|
|
1154
|
+
this.s = s
|
|
1155
|
+
this.f = f
|
|
1097
1156
|
|
|
1098
|
-
return true
|
|
1157
|
+
return true
|
|
1099
1158
|
},
|
|
1100
|
-
resetTime: function resetTime() {
|
|
1101
|
-
this.h = 0;
|
|
1102
|
-
this.i = 0;
|
|
1103
|
-
this.s = 0;
|
|
1104
|
-
this.f = 0;
|
|
1105
|
-
this.times = 0;
|
|
1106
1159
|
|
|
1107
|
-
|
|
1160
|
+
resetTime() {
|
|
1161
|
+
this.h = 0
|
|
1162
|
+
this.i = 0
|
|
1163
|
+
this.s = 0
|
|
1164
|
+
this.f = 0
|
|
1165
|
+
this.times = 0
|
|
1166
|
+
|
|
1167
|
+
return true
|
|
1108
1168
|
},
|
|
1109
|
-
|
|
1169
|
+
|
|
1170
|
+
zone(minutes) {
|
|
1110
1171
|
if (this.zones <= 1) {
|
|
1111
|
-
this.zones
|
|
1112
|
-
this.z = minutes
|
|
1113
|
-
return true
|
|
1172
|
+
this.zones++
|
|
1173
|
+
this.z = minutes
|
|
1174
|
+
return true
|
|
1114
1175
|
}
|
|
1115
1176
|
|
|
1116
|
-
return false
|
|
1177
|
+
return false
|
|
1117
1178
|
},
|
|
1118
|
-
|
|
1179
|
+
|
|
1180
|
+
toDate(relativeTo) {
|
|
1119
1181
|
if (this.dates && !this.times) {
|
|
1120
|
-
this.h = this.i = this.s = this.f = 0
|
|
1182
|
+
this.h = this.i = this.s = this.f = 0
|
|
1121
1183
|
}
|
|
1122
1184
|
|
|
1123
1185
|
// fill holes
|
|
1124
1186
|
if (isNaN(this.y)) {
|
|
1125
|
-
this.y = relativeTo.getFullYear()
|
|
1187
|
+
this.y = relativeTo.getFullYear()
|
|
1126
1188
|
}
|
|
1127
1189
|
|
|
1128
1190
|
if (isNaN(this.m)) {
|
|
1129
|
-
this.m = relativeTo.getMonth()
|
|
1191
|
+
this.m = relativeTo.getMonth()
|
|
1130
1192
|
}
|
|
1131
1193
|
|
|
1132
1194
|
if (isNaN(this.d)) {
|
|
1133
|
-
this.d = relativeTo.getDate()
|
|
1195
|
+
this.d = relativeTo.getDate()
|
|
1134
1196
|
}
|
|
1135
1197
|
|
|
1136
1198
|
if (isNaN(this.h)) {
|
|
1137
|
-
this.h = relativeTo.getHours()
|
|
1199
|
+
this.h = relativeTo.getHours()
|
|
1138
1200
|
}
|
|
1139
1201
|
|
|
1140
1202
|
if (isNaN(this.i)) {
|
|
1141
|
-
this.i = relativeTo.getMinutes()
|
|
1203
|
+
this.i = relativeTo.getMinutes()
|
|
1142
1204
|
}
|
|
1143
1205
|
|
|
1144
1206
|
if (isNaN(this.s)) {
|
|
1145
|
-
this.s = relativeTo.getSeconds()
|
|
1207
|
+
this.s = relativeTo.getSeconds()
|
|
1146
1208
|
}
|
|
1147
1209
|
|
|
1148
1210
|
if (isNaN(this.f)) {
|
|
1149
|
-
this.f = relativeTo.getMilliseconds()
|
|
1211
|
+
this.f = relativeTo.getMilliseconds()
|
|
1150
1212
|
}
|
|
1151
1213
|
|
|
1152
1214
|
// adjust special early
|
|
1153
1215
|
switch (this.firstOrLastDayOfMonth) {
|
|
1154
1216
|
case 1:
|
|
1155
|
-
this.d = 1
|
|
1156
|
-
break
|
|
1217
|
+
this.d = 1
|
|
1218
|
+
break
|
|
1157
1219
|
case -1:
|
|
1158
|
-
this.d = 0
|
|
1159
|
-
this.m += 1
|
|
1160
|
-
break
|
|
1220
|
+
this.d = 0
|
|
1221
|
+
this.m += 1
|
|
1222
|
+
break
|
|
1161
1223
|
}
|
|
1162
1224
|
|
|
1163
1225
|
if (!isNaN(this.weekday)) {
|
|
1164
|
-
|
|
1165
|
-
date.setFullYear(this.y, this.m, this.d)
|
|
1166
|
-
date.setHours(this.h, this.i, this.s, this.f)
|
|
1226
|
+
const date = new Date(relativeTo.getTime())
|
|
1227
|
+
date.setFullYear(this.y, this.m, this.d)
|
|
1228
|
+
date.setHours(this.h, this.i, this.s, this.f)
|
|
1167
1229
|
|
|
1168
|
-
|
|
1230
|
+
const dow = date.getDay()
|
|
1169
1231
|
|
|
1170
1232
|
if (this.weekdayBehavior === 2) {
|
|
1171
1233
|
// To make "this week" work, where the current day of week is a "sunday"
|
|
1172
1234
|
if (dow === 0 && this.weekday !== 0) {
|
|
1173
|
-
this.weekday = -6
|
|
1235
|
+
this.weekday = -6
|
|
1174
1236
|
}
|
|
1175
1237
|
|
|
1176
1238
|
// To make "sunday this week" work, where the current day of week is not a "sunday"
|
|
1177
1239
|
if (this.weekday === 0 && dow !== 0) {
|
|
1178
|
-
this.weekday = 7
|
|
1240
|
+
this.weekday = 7
|
|
1179
1241
|
}
|
|
1180
1242
|
|
|
1181
|
-
this.d -= dow
|
|
1182
|
-
this.d += this.weekday
|
|
1243
|
+
this.d -= dow
|
|
1244
|
+
this.d += this.weekday
|
|
1183
1245
|
} else {
|
|
1184
|
-
|
|
1246
|
+
let diff = this.weekday - dow
|
|
1185
1247
|
|
|
1186
1248
|
// some PHP magic
|
|
1187
|
-
if (this.rd < 0 && diff < 0 || this.rd >= 0 && diff <= -this.weekdayBehavior) {
|
|
1188
|
-
diff += 7
|
|
1249
|
+
if ((this.rd < 0 && diff < 0) || (this.rd >= 0 && diff <= -this.weekdayBehavior)) {
|
|
1250
|
+
diff += 7
|
|
1189
1251
|
}
|
|
1190
1252
|
|
|
1191
1253
|
if (this.weekday >= 0) {
|
|
1192
|
-
this.d += diff
|
|
1254
|
+
this.d += diff
|
|
1193
1255
|
} else {
|
|
1194
|
-
this.d -= 7 - (Math.abs(this.weekday) - dow)
|
|
1256
|
+
this.d -= 7 - (Math.abs(this.weekday) - dow)
|
|
1195
1257
|
}
|
|
1196
1258
|
|
|
1197
|
-
this.weekday = NaN
|
|
1259
|
+
this.weekday = NaN
|
|
1198
1260
|
}
|
|
1199
1261
|
}
|
|
1200
1262
|
|
|
1201
1263
|
// adjust relative
|
|
1202
|
-
this.y += this.ry
|
|
1203
|
-
this.m += this.rm
|
|
1204
|
-
this.d += this.rd
|
|
1264
|
+
this.y += this.ry
|
|
1265
|
+
this.m += this.rm
|
|
1266
|
+
this.d += this.rd
|
|
1205
1267
|
|
|
1206
|
-
this.h += this.rh
|
|
1207
|
-
this.i += this.ri
|
|
1208
|
-
this.s += this.rs
|
|
1209
|
-
this.f += this.rf
|
|
1268
|
+
this.h += this.rh
|
|
1269
|
+
this.i += this.ri
|
|
1270
|
+
this.s += this.rs
|
|
1271
|
+
this.f += this.rf
|
|
1210
1272
|
|
|
1211
|
-
this.ry = this.rm = this.rd = 0
|
|
1212
|
-
this.rh = this.ri = this.rs = this.rf = 0
|
|
1273
|
+
this.ry = this.rm = this.rd = 0
|
|
1274
|
+
this.rh = this.ri = this.rs = this.rf = 0
|
|
1213
1275
|
|
|
1214
|
-
|
|
1276
|
+
const result = new Date(relativeTo.getTime())
|
|
1215
1277
|
// since Date constructor treats years <= 99 as 1900+
|
|
1216
1278
|
// it can't be used, thus this weird way
|
|
1217
|
-
result.setFullYear(this.y, this.m, this.d)
|
|
1218
|
-
result.setHours(this.h, this.i, this.s, this.f)
|
|
1279
|
+
result.setFullYear(this.y, this.m, this.d)
|
|
1280
|
+
result.setHours(this.h, this.i, this.s, this.f)
|
|
1219
1281
|
|
|
1220
|
-
//
|
|
1282
|
+
// note: this is done twice in PHP
|
|
1221
1283
|
// early when processing special relatives
|
|
1222
1284
|
// and late
|
|
1223
1285
|
// todo: check if the logic can be reduced
|
|
1224
1286
|
// to just one time action
|
|
1225
1287
|
switch (this.firstOrLastDayOfMonth) {
|
|
1226
1288
|
case 1:
|
|
1227
|
-
result.setDate(1)
|
|
1228
|
-
break
|
|
1289
|
+
result.setDate(1)
|
|
1290
|
+
break
|
|
1229
1291
|
case -1:
|
|
1230
|
-
result.setMonth(result.getMonth() + 1, 0)
|
|
1231
|
-
break
|
|
1292
|
+
result.setMonth(result.getMonth() + 1, 0)
|
|
1293
|
+
break
|
|
1232
1294
|
}
|
|
1233
1295
|
|
|
1234
1296
|
// adjust timezone
|
|
1235
1297
|
if (!isNaN(this.z) && result.getTimezoneOffset() !== this.z) {
|
|
1236
|
-
result.setUTCFullYear(result.getFullYear(), result.getMonth(), result.getDate())
|
|
1298
|
+
result.setUTCFullYear(result.getFullYear(), result.getMonth(), result.getDate())
|
|
1237
1299
|
|
|
1238
|
-
result.setUTCHours(result.getHours(), result.getMinutes(), result.getSeconds() - this.z, result.getMilliseconds())
|
|
1300
|
+
result.setUTCHours(result.getHours(), result.getMinutes(), result.getSeconds() - this.z, result.getMilliseconds())
|
|
1239
1301
|
}
|
|
1240
1302
|
|
|
1241
|
-
return result
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1303
|
+
return result
|
|
1304
|
+
},
|
|
1305
|
+
}
|
|
1244
1306
|
|
|
1245
1307
|
module.exports = function strtotime(str, now) {
|
|
1246
1308
|
// discuss at: https://locutus.io/php/strtotime/
|
|
@@ -1274,44 +1336,101 @@ module.exports = function strtotime(str, now) {
|
|
|
1274
1336
|
// returns 7: 1499644800
|
|
1275
1337
|
|
|
1276
1338
|
if (now == null) {
|
|
1277
|
-
now = Math.floor(Date.now() / 1000)
|
|
1339
|
+
now = Math.floor(Date.now() / 1000)
|
|
1278
1340
|
}
|
|
1279
1341
|
|
|
1280
1342
|
// the rule order is important
|
|
1281
1343
|
// if multiple rules match, the longest match wins
|
|
1282
1344
|
// if multiple rules match the same string, the first match wins
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1345
|
+
const rules = [
|
|
1346
|
+
formats.yesterday,
|
|
1347
|
+
formats.now,
|
|
1348
|
+
formats.noon,
|
|
1349
|
+
formats.midnightOrToday,
|
|
1350
|
+
formats.tomorrow,
|
|
1351
|
+
formats.timestamp,
|
|
1352
|
+
formats.firstOrLastDay,
|
|
1353
|
+
formats.backOrFrontOf,
|
|
1354
|
+
// formats.weekdayOf, // not yet implemented
|
|
1355
|
+
formats.timeTiny12,
|
|
1356
|
+
formats.timeShort12,
|
|
1357
|
+
formats.timeLong12,
|
|
1358
|
+
formats.mssqltime,
|
|
1359
|
+
formats.oracledate,
|
|
1360
|
+
formats.timeShort24,
|
|
1361
|
+
formats.timeLong24,
|
|
1362
|
+
formats.iso8601long,
|
|
1363
|
+
formats.gnuNoColon,
|
|
1364
|
+
formats.iso8601noColon,
|
|
1365
|
+
formats.americanShort,
|
|
1366
|
+
formats.american,
|
|
1367
|
+
formats.iso8601date4,
|
|
1368
|
+
formats.iso8601dateSlash,
|
|
1369
|
+
formats.dateSlash,
|
|
1370
|
+
formats.gnuDateShortOrIso8601date2,
|
|
1371
|
+
formats.gnuDateShorter,
|
|
1372
|
+
formats.dateFull,
|
|
1373
|
+
formats.pointedDate4,
|
|
1374
|
+
formats.pointedDate2,
|
|
1375
|
+
formats.dateNoDay,
|
|
1376
|
+
formats.dateNoDayRev,
|
|
1377
|
+
formats.dateTextual,
|
|
1378
|
+
formats.dateNoYear,
|
|
1379
|
+
formats.dateNoYearRev,
|
|
1380
|
+
formats.dateNoColon,
|
|
1381
|
+
formats.xmlRpc,
|
|
1382
|
+
formats.xmlRpcNoColon,
|
|
1383
|
+
formats.soap,
|
|
1384
|
+
formats.wddx,
|
|
1385
|
+
formats.exif,
|
|
1386
|
+
formats.pgydotd,
|
|
1387
|
+
formats.isoWeekDay,
|
|
1388
|
+
formats.pgTextShort,
|
|
1389
|
+
formats.pgTextReverse,
|
|
1390
|
+
formats.clf,
|
|
1391
|
+
formats.year4,
|
|
1392
|
+
formats.ago,
|
|
1393
|
+
formats.dayText,
|
|
1394
|
+
formats.relativeTextWeek,
|
|
1395
|
+
formats.relativeText,
|
|
1396
|
+
formats.monthFullOrMonthAbbr,
|
|
1397
|
+
formats.tzCorrection,
|
|
1398
|
+
formats.tzAbbr,
|
|
1399
|
+
formats.dateShortWithTimeShort12,
|
|
1400
|
+
formats.dateShortWithTimeLong12,
|
|
1401
|
+
formats.dateShortWithTimeShort,
|
|
1402
|
+
formats.dateShortWithTimeLong,
|
|
1403
|
+
formats.relative,
|
|
1404
|
+
formats.whitespace,
|
|
1405
|
+
]
|
|
1406
|
+
|
|
1407
|
+
const result = Object.create(resultProto)
|
|
1288
1408
|
|
|
1289
1409
|
while (str.length) {
|
|
1290
|
-
|
|
1291
|
-
|
|
1410
|
+
let longestMatch = null
|
|
1411
|
+
let finalRule = null
|
|
1292
1412
|
|
|
1293
|
-
for (
|
|
1294
|
-
|
|
1413
|
+
for (let i = 0, l = rules.length; i < l; i++) {
|
|
1414
|
+
const format = rules[i]
|
|
1295
1415
|
|
|
1296
|
-
|
|
1416
|
+
const match = str.match(format.regex)
|
|
1297
1417
|
|
|
1298
1418
|
if (match) {
|
|
1299
1419
|
if (!longestMatch || match[0].length > longestMatch[0].length) {
|
|
1300
|
-
longestMatch = match
|
|
1301
|
-
finalRule = format
|
|
1420
|
+
longestMatch = match
|
|
1421
|
+
finalRule = format
|
|
1302
1422
|
}
|
|
1303
1423
|
}
|
|
1304
1424
|
}
|
|
1305
1425
|
|
|
1306
|
-
if (!finalRule || finalRule.callback && finalRule.callback.apply(result, longestMatch) === false) {
|
|
1307
|
-
return false
|
|
1426
|
+
if (!finalRule || (finalRule.callback && finalRule.callback.apply(result, longestMatch) === false)) {
|
|
1427
|
+
return false
|
|
1308
1428
|
}
|
|
1309
1429
|
|
|
1310
|
-
str = str.substr(longestMatch[0].length)
|
|
1311
|
-
finalRule = null
|
|
1312
|
-
longestMatch = null
|
|
1430
|
+
str = str.substr(longestMatch[0].length)
|
|
1431
|
+
finalRule = null
|
|
1432
|
+
longestMatch = null
|
|
1313
1433
|
}
|
|
1314
1434
|
|
|
1315
|
-
return Math.floor(result.toDate(new Date(now * 1000)) / 1000)
|
|
1316
|
-
}
|
|
1317
|
-
//# sourceMappingURL=strtotime.js.map
|
|
1435
|
+
return Math.floor(result.toDate(new Date(now * 1000)) / 1000)
|
|
1436
|
+
}
|