locutus 2.0.32 → 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 +18 -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 +9 -11
- package/php/filesystem/file_get_contents.js +3 -6
- package/php/filesystem/index.js +6 -9
- 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_exists.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
package/php/datetime/date.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function date(format, timestamp) {
|
|
4
2
|
// discuss at: https://locutus.io/php/date/
|
|
5
3
|
// original by: Carlos R. L. Rodrigues (https://www.jsfromhell.com)
|
|
@@ -60,205 +58,224 @@ module.exports = function date(format, timestamp) {
|
|
|
60
58
|
// returns 8: '52'
|
|
61
59
|
// example 9: date('W Y-m-d', 1293974054); // 2011-01-02
|
|
62
60
|
// returns 9: '52 2011-01-02'
|
|
63
|
-
// test: skip-1 skip-2 skip-5
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
let jsdate
|
|
63
|
+
let f
|
|
67
64
|
// Keep this here (works, but for code commented-out below for file size reasons)
|
|
68
65
|
// var tal= [];
|
|
69
|
-
|
|
66
|
+
const txtWords = [
|
|
67
|
+
'Sun',
|
|
68
|
+
'Mon',
|
|
69
|
+
'Tues',
|
|
70
|
+
'Wednes',
|
|
71
|
+
'Thurs',
|
|
72
|
+
'Fri',
|
|
73
|
+
'Satur',
|
|
74
|
+
'January',
|
|
75
|
+
'February',
|
|
76
|
+
'March',
|
|
77
|
+
'April',
|
|
78
|
+
'May',
|
|
79
|
+
'June',
|
|
80
|
+
'July',
|
|
81
|
+
'August',
|
|
82
|
+
'September',
|
|
83
|
+
'October',
|
|
84
|
+
'November',
|
|
85
|
+
'December',
|
|
86
|
+
]
|
|
70
87
|
// trailing backslash -> (dropped)
|
|
71
88
|
// a backslash followed by any character (including backslash) -> the character
|
|
72
89
|
// empty string -> empty string
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return f[t] ? f[t]() : s
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
n = String(n)
|
|
90
|
+
const formatChr = /\\?(.?)/gi
|
|
91
|
+
const formatChrCb = function (t, s) {
|
|
92
|
+
return f[t] ? f[t]() : s
|
|
93
|
+
}
|
|
94
|
+
const _pad = function (n, c) {
|
|
95
|
+
n = String(n)
|
|
79
96
|
while (n.length < c) {
|
|
80
|
-
n = '0' + n
|
|
97
|
+
n = '0' + n
|
|
81
98
|
}
|
|
82
|
-
return n
|
|
83
|
-
}
|
|
99
|
+
return n
|
|
100
|
+
}
|
|
84
101
|
f = {
|
|
85
102
|
// Day
|
|
86
|
-
d: function
|
|
103
|
+
d: function () {
|
|
87
104
|
// Day of month w/leading 0; 01..31
|
|
88
|
-
return _pad(f.j(), 2)
|
|
105
|
+
return _pad(f.j(), 2)
|
|
89
106
|
},
|
|
90
|
-
D: function
|
|
107
|
+
D: function () {
|
|
91
108
|
// Shorthand day name; Mon...Sun
|
|
92
|
-
return f.l().slice(0, 3)
|
|
109
|
+
return f.l().slice(0, 3)
|
|
93
110
|
},
|
|
94
|
-
j: function
|
|
111
|
+
j: function () {
|
|
95
112
|
// Day of month; 1..31
|
|
96
|
-
return jsdate.getDate()
|
|
113
|
+
return jsdate.getDate()
|
|
97
114
|
},
|
|
98
|
-
l: function
|
|
115
|
+
l: function () {
|
|
99
116
|
// Full day name; Monday...Sunday
|
|
100
|
-
return txtWords[f.w()] + 'day'
|
|
117
|
+
return txtWords[f.w()] + 'day'
|
|
101
118
|
},
|
|
102
|
-
N: function
|
|
119
|
+
N: function () {
|
|
103
120
|
// ISO-8601 day of week; 1[Mon]..7[Sun]
|
|
104
|
-
return f.w() || 7
|
|
121
|
+
return f.w() || 7
|
|
105
122
|
},
|
|
106
|
-
S: function
|
|
123
|
+
S: function () {
|
|
107
124
|
// Ordinal suffix for day of month; st, nd, rd, th
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (i <= 3 && parseInt(j % 100 / 10, 10) === 1) {
|
|
111
|
-
i = 0
|
|
125
|
+
const j = f.j()
|
|
126
|
+
let i = j % 10
|
|
127
|
+
if (i <= 3 && parseInt((j % 100) / 10, 10) === 1) {
|
|
128
|
+
i = 0
|
|
112
129
|
}
|
|
113
|
-
return ['st', 'nd', 'rd'][i - 1] || 'th'
|
|
130
|
+
return ['st', 'nd', 'rd'][i - 1] || 'th'
|
|
114
131
|
},
|
|
115
|
-
w: function
|
|
132
|
+
w: function () {
|
|
116
133
|
// Day of week; 0[Sun]..6[Sat]
|
|
117
|
-
return jsdate.getDay()
|
|
134
|
+
return jsdate.getDay()
|
|
118
135
|
},
|
|
119
|
-
z: function
|
|
136
|
+
z: function () {
|
|
120
137
|
// Day of year; 0..365
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return Math.round((a - b) / 864e5)
|
|
138
|
+
const a = new Date(f.Y(), f.n() - 1, f.j())
|
|
139
|
+
const b = new Date(f.Y(), 0, 1)
|
|
140
|
+
return Math.round((a - b) / 864e5)
|
|
124
141
|
},
|
|
125
142
|
|
|
126
143
|
// Week
|
|
127
|
-
W: function
|
|
144
|
+
W: function () {
|
|
128
145
|
// ISO-8601 week number
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return _pad(1 + Math.round((a - b) / 864e5 / 7), 2)
|
|
146
|
+
const a = new Date(f.Y(), f.n() - 1, f.j() - f.N() + 3)
|
|
147
|
+
const b = new Date(a.getFullYear(), 0, 4)
|
|
148
|
+
return _pad(1 + Math.round((a - b) / 864e5 / 7), 2)
|
|
132
149
|
},
|
|
133
150
|
|
|
134
151
|
// Month
|
|
135
|
-
F: function
|
|
152
|
+
F: function () {
|
|
136
153
|
// Full month name; January...December
|
|
137
|
-
return txtWords[6 + f.n()]
|
|
154
|
+
return txtWords[6 + f.n()]
|
|
138
155
|
},
|
|
139
|
-
m: function
|
|
156
|
+
m: function () {
|
|
140
157
|
// Month w/leading 0; 01...12
|
|
141
|
-
return _pad(f.n(), 2)
|
|
158
|
+
return _pad(f.n(), 2)
|
|
142
159
|
},
|
|
143
|
-
M: function
|
|
160
|
+
M: function () {
|
|
144
161
|
// Shorthand month name; Jan...Dec
|
|
145
|
-
return f.F().slice(0, 3)
|
|
162
|
+
return f.F().slice(0, 3)
|
|
146
163
|
},
|
|
147
|
-
n: function
|
|
164
|
+
n: function () {
|
|
148
165
|
// Month; 1...12
|
|
149
|
-
return jsdate.getMonth() + 1
|
|
166
|
+
return jsdate.getMonth() + 1
|
|
150
167
|
},
|
|
151
|
-
t: function
|
|
168
|
+
t: function () {
|
|
152
169
|
// Days in month; 28...31
|
|
153
|
-
return new Date(f.Y(), f.n(), 0).getDate()
|
|
170
|
+
return new Date(f.Y(), f.n(), 0).getDate()
|
|
154
171
|
},
|
|
155
172
|
|
|
156
173
|
// Year
|
|
157
|
-
L: function
|
|
174
|
+
L: function () {
|
|
158
175
|
// Is leap year?; 0 or 1
|
|
159
|
-
|
|
160
|
-
return j % 4 === 0 & j % 100 !== 0 | j % 400 === 0
|
|
176
|
+
const j = f.Y()
|
|
177
|
+
return ((j % 4 === 0) & (j % 100 !== 0)) | (j % 400 === 0)
|
|
161
178
|
},
|
|
162
|
-
o: function
|
|
179
|
+
o: function () {
|
|
163
180
|
// ISO-8601 year
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0)
|
|
181
|
+
const n = f.n()
|
|
182
|
+
const W = f.W()
|
|
183
|
+
const Y = f.Y()
|
|
184
|
+
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0)
|
|
168
185
|
},
|
|
169
|
-
Y: function
|
|
186
|
+
Y: function () {
|
|
170
187
|
// Full year; e.g. 1980...2010
|
|
171
|
-
return jsdate.getFullYear()
|
|
188
|
+
return jsdate.getFullYear()
|
|
172
189
|
},
|
|
173
|
-
y: function
|
|
190
|
+
y: function () {
|
|
174
191
|
// Last two digits of year; 00...99
|
|
175
|
-
return f.Y().toString().slice(-2)
|
|
192
|
+
return f.Y().toString().slice(-2)
|
|
176
193
|
},
|
|
177
194
|
|
|
178
195
|
// Time
|
|
179
|
-
a: function
|
|
196
|
+
a: function () {
|
|
180
197
|
// am or pm
|
|
181
|
-
return jsdate.getHours() > 11 ? 'pm' : 'am'
|
|
198
|
+
return jsdate.getHours() > 11 ? 'pm' : 'am'
|
|
182
199
|
},
|
|
183
|
-
A: function
|
|
200
|
+
A: function () {
|
|
184
201
|
// AM or PM
|
|
185
|
-
return f.a().toUpperCase()
|
|
202
|
+
return f.a().toUpperCase()
|
|
186
203
|
},
|
|
187
|
-
B: function
|
|
204
|
+
B: function () {
|
|
188
205
|
// Swatch Internet time; 000..999
|
|
189
|
-
|
|
206
|
+
const H = jsdate.getUTCHours() * 36e2
|
|
190
207
|
// Hours
|
|
191
|
-
|
|
208
|
+
const i = jsdate.getUTCMinutes() * 60
|
|
192
209
|
// Minutes
|
|
193
210
|
// Seconds
|
|
194
|
-
|
|
195
|
-
return _pad(Math.floor((H + i + s + 36e2) / 86.4) % 1e3, 3)
|
|
211
|
+
const s = jsdate.getUTCSeconds()
|
|
212
|
+
return _pad(Math.floor((H + i + s + 36e2) / 86.4) % 1e3, 3)
|
|
196
213
|
},
|
|
197
|
-
g: function
|
|
214
|
+
g: function () {
|
|
198
215
|
// 12-Hours; 1..12
|
|
199
|
-
return f.G() % 12 || 12
|
|
216
|
+
return f.G() % 12 || 12
|
|
200
217
|
},
|
|
201
|
-
G: function
|
|
218
|
+
G: function () {
|
|
202
219
|
// 24-Hours; 0..23
|
|
203
|
-
return jsdate.getHours()
|
|
220
|
+
return jsdate.getHours()
|
|
204
221
|
},
|
|
205
|
-
h: function
|
|
222
|
+
h: function () {
|
|
206
223
|
// 12-Hours w/leading 0; 01..12
|
|
207
|
-
return _pad(f.g(), 2)
|
|
224
|
+
return _pad(f.g(), 2)
|
|
208
225
|
},
|
|
209
|
-
H: function
|
|
226
|
+
H: function () {
|
|
210
227
|
// 24-Hours w/leading 0; 00..23
|
|
211
|
-
return _pad(f.G(), 2)
|
|
228
|
+
return _pad(f.G(), 2)
|
|
212
229
|
},
|
|
213
|
-
i: function
|
|
230
|
+
i: function () {
|
|
214
231
|
// Minutes w/leading 0; 00..59
|
|
215
|
-
return _pad(jsdate.getMinutes(), 2)
|
|
232
|
+
return _pad(jsdate.getMinutes(), 2)
|
|
216
233
|
},
|
|
217
|
-
s: function
|
|
234
|
+
s: function () {
|
|
218
235
|
// Seconds w/leading 0; 00..59
|
|
219
|
-
return _pad(jsdate.getSeconds(), 2)
|
|
236
|
+
return _pad(jsdate.getSeconds(), 2)
|
|
220
237
|
},
|
|
221
|
-
u: function
|
|
238
|
+
u: function () {
|
|
222
239
|
// Microseconds; 000000-999000
|
|
223
|
-
return _pad(jsdate.getMilliseconds() * 1000, 6)
|
|
240
|
+
return _pad(jsdate.getMilliseconds() * 1000, 6)
|
|
224
241
|
},
|
|
225
242
|
|
|
226
243
|
// Timezone
|
|
227
|
-
e: function
|
|
244
|
+
e: function () {
|
|
228
245
|
// Timezone identifier; e.g. Atlantic/Azores, ...
|
|
229
246
|
// The following works, but requires inclusion of the very large
|
|
230
247
|
// timezone_abbreviations_list() function.
|
|
231
248
|
/* return that.date_default_timezone_get();
|
|
232
249
|
*/
|
|
233
|
-
|
|
234
|
-
throw new Error(msg)
|
|
250
|
+
const msg = 'Not supported (see source code of date() for timezone on how to add support)'
|
|
251
|
+
throw new Error(msg)
|
|
235
252
|
},
|
|
236
|
-
I: function
|
|
253
|
+
I: function () {
|
|
237
254
|
// DST observed?; 0 or 1
|
|
238
255
|
// Compares Jan 1 minus Jan 1 UTC to Jul 1 minus Jul 1 UTC.
|
|
239
256
|
// If they are not equal, then DST is observed.
|
|
240
|
-
|
|
257
|
+
const a = new Date(f.Y(), 0)
|
|
241
258
|
// Jan 1
|
|
242
|
-
|
|
259
|
+
const c = Date.UTC(f.Y(), 0)
|
|
243
260
|
// Jan 1 UTC
|
|
244
|
-
|
|
261
|
+
const b = new Date(f.Y(), 6)
|
|
245
262
|
// Jul 1
|
|
246
263
|
// Jul 1 UTC
|
|
247
|
-
|
|
248
|
-
return a - c !== b - d ? 1 : 0
|
|
264
|
+
const d = Date.UTC(f.Y(), 6)
|
|
265
|
+
return a - c !== b - d ? 1 : 0
|
|
249
266
|
},
|
|
250
|
-
O: function
|
|
267
|
+
O: function () {
|
|
251
268
|
// Difference to GMT in hour format; e.g. +0200
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return (tzo > 0 ? '-' : '+') + _pad(Math.floor(a / 60) * 100 + a % 60, 4)
|
|
269
|
+
const tzo = jsdate.getTimezoneOffset()
|
|
270
|
+
const a = Math.abs(tzo)
|
|
271
|
+
return (tzo > 0 ? '-' : '+') + _pad(Math.floor(a / 60) * 100 + (a % 60), 4)
|
|
255
272
|
},
|
|
256
|
-
P: function
|
|
273
|
+
P: function () {
|
|
257
274
|
// Difference to GMT w/colon; e.g. +02:00
|
|
258
|
-
|
|
259
|
-
return O.substr(0, 3) + ':' + O.substr(3, 2)
|
|
275
|
+
const O = f.O()
|
|
276
|
+
return O.substr(0, 3) + ':' + O.substr(3, 2)
|
|
260
277
|
},
|
|
261
|
-
T: function
|
|
278
|
+
T: function () {
|
|
262
279
|
// The following works, but requires inclusion of the very
|
|
263
280
|
// large timezone_abbreviations_list() function.
|
|
264
281
|
/* var abbr, i, os, _default;
|
|
@@ -284,35 +301,37 @@ module.exports = function date(format, timestamp) {
|
|
|
284
301
|
}
|
|
285
302
|
}
|
|
286
303
|
*/
|
|
287
|
-
return 'UTC'
|
|
304
|
+
return 'UTC'
|
|
288
305
|
},
|
|
289
|
-
Z: function
|
|
306
|
+
Z: function () {
|
|
290
307
|
// Timezone offset in seconds (-43200...50400)
|
|
291
|
-
return -jsdate.getTimezoneOffset() * 60
|
|
308
|
+
return -jsdate.getTimezoneOffset() * 60
|
|
292
309
|
},
|
|
293
310
|
|
|
294
311
|
// Full Date/Time
|
|
295
|
-
c: function
|
|
312
|
+
c: function () {
|
|
296
313
|
// ISO-8601 date.
|
|
297
|
-
return 'Y-m-d\\TH:i:sP'.replace(formatChr, formatChrCb)
|
|
314
|
+
return 'Y-m-d\\TH:i:sP'.replace(formatChr, formatChrCb)
|
|
298
315
|
},
|
|
299
|
-
r: function
|
|
316
|
+
r: function () {
|
|
300
317
|
// RFC 2822
|
|
301
|
-
return 'D, d M Y H:i:s O'.replace(formatChr, formatChrCb)
|
|
318
|
+
return 'D, d M Y H:i:s O'.replace(formatChr, formatChrCb)
|
|
302
319
|
},
|
|
303
|
-
U: function
|
|
320
|
+
U: function () {
|
|
304
321
|
// Seconds since UNIX epoch
|
|
305
|
-
return jsdate / 1000 | 0
|
|
306
|
-
}
|
|
307
|
-
}
|
|
322
|
+
return (jsdate / 1000) | 0
|
|
323
|
+
},
|
|
324
|
+
}
|
|
308
325
|
|
|
309
|
-
|
|
310
|
-
jsdate =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
326
|
+
const _date = function (format, timestamp) {
|
|
327
|
+
jsdate =
|
|
328
|
+
timestamp === undefined
|
|
329
|
+
? new Date() // Not provided
|
|
330
|
+
: timestamp instanceof Date
|
|
331
|
+
? new Date(timestamp) // JS Date()
|
|
332
|
+
: new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int)
|
|
333
|
+
return format.replace(formatChr, formatChrCb)
|
|
334
|
+
}
|
|
315
335
|
|
|
316
|
-
return _date(format, timestamp)
|
|
317
|
-
}
|
|
318
|
-
//# sourceMappingURL=date.js.map
|
|
336
|
+
return _date(format, timestamp)
|
|
337
|
+
}
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function date_parse(date) {
|
|
4
2
|
// discuss at: https://locutus.io/php/date_parse/
|
|
5
3
|
// original by: Brett Zamir (https://brett-zamir.me)
|
|
6
4
|
// example 1: date_parse('2006-12-12 10:00:00')
|
|
7
5
|
// returns 1: {year : 2006, month: 12, day: 12, hour: 10, minute: 0, second: 0, fraction: 0, is_localtime: false}
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const strtotime = require('../datetime/strtotime')
|
|
8
|
+
let ts
|
|
11
9
|
|
|
12
10
|
try {
|
|
13
|
-
ts = strtotime(date)
|
|
14
|
-
} catch (
|
|
15
|
-
ts = false
|
|
11
|
+
ts = strtotime(date)
|
|
12
|
+
} catch (_e) {
|
|
13
|
+
ts = false
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
if (!ts) {
|
|
19
|
-
return false
|
|
17
|
+
return false
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
const dt = new Date(ts * 1000)
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
const retObj = {}
|
|
25
23
|
|
|
26
|
-
retObj.year = dt.getFullYear()
|
|
27
|
-
retObj.month = dt.getMonth() + 1
|
|
28
|
-
retObj.day = dt.getDate()
|
|
29
|
-
retObj.hour = dt.getHours()
|
|
30
|
-
retObj.minute = dt.getMinutes()
|
|
31
|
-
retObj.second = dt.getSeconds()
|
|
32
|
-
retObj.fraction = parseFloat('0.' + dt.getMilliseconds())
|
|
33
|
-
retObj.is_localtime = dt.getTimezoneOffset() !== 0
|
|
24
|
+
retObj.year = dt.getFullYear()
|
|
25
|
+
retObj.month = dt.getMonth() + 1
|
|
26
|
+
retObj.day = dt.getDate()
|
|
27
|
+
retObj.hour = dt.getHours()
|
|
28
|
+
retObj.minute = dt.getMinutes()
|
|
29
|
+
retObj.second = dt.getSeconds()
|
|
30
|
+
retObj.fraction = parseFloat('0.' + dt.getMilliseconds())
|
|
31
|
+
retObj.is_localtime = dt.getTimezoneOffset() !== 0
|
|
34
32
|
|
|
35
|
-
return retObj
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=date_parse.js.map
|
|
33
|
+
return retObj
|
|
34
|
+
}
|
package/php/datetime/getdate.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function getdate(timestamp) {
|
|
4
2
|
// discuss at: https://locutus.io/php/getdate/
|
|
5
3
|
// original by: Paulo Freitas
|
|
@@ -8,27 +6,43 @@ module.exports = function getdate(timestamp) {
|
|
|
8
6
|
// example 1: getdate(1055901520)
|
|
9
7
|
// returns 1: {'seconds': 40, 'minutes': 58, 'hours': 1, 'mday': 18, 'wday': 3, 'mon': 6, 'year': 2003, 'yday': 168, 'weekday': 'Wednesday', 'month': 'June', '0': 1055901520}
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
const _w = ['Sun', 'Mon', 'Tues', 'Wednes', 'Thurs', 'Fri', 'Satur']
|
|
10
|
+
const _m = [
|
|
11
|
+
'January',
|
|
12
|
+
'February',
|
|
13
|
+
'March',
|
|
14
|
+
'April',
|
|
15
|
+
'May',
|
|
16
|
+
'June',
|
|
17
|
+
'July',
|
|
18
|
+
'August',
|
|
19
|
+
'September',
|
|
20
|
+
'October',
|
|
21
|
+
'November',
|
|
22
|
+
'December',
|
|
23
|
+
]
|
|
24
|
+
const d =
|
|
25
|
+
typeof timestamp === 'undefined'
|
|
26
|
+
? new Date()
|
|
27
|
+
: timestamp instanceof Date
|
|
28
|
+
? new Date(timestamp) // Not provided
|
|
29
|
+
: new Date(timestamp * 1000) // Javascript Date() // UNIX timestamp (auto-convert to int)
|
|
30
|
+
const w = d.getDay()
|
|
31
|
+
const m = d.getMonth()
|
|
32
|
+
const y = d.getFullYear()
|
|
33
|
+
const r = {}
|
|
19
34
|
|
|
20
|
-
r.seconds = d.getSeconds()
|
|
21
|
-
r.minutes = d.getMinutes()
|
|
22
|
-
r.hours = d.getHours()
|
|
23
|
-
r.mday = d.getDate()
|
|
24
|
-
r.wday = w
|
|
25
|
-
r.mon = m + 1
|
|
26
|
-
r.year = y
|
|
27
|
-
r.yday = Math.floor((d - new Date(y, 0, 1)) / 86400000)
|
|
28
|
-
r.weekday = _w[w] + 'day'
|
|
29
|
-
r.month = _m[m]
|
|
30
|
-
r['0'] = parseInt(d.getTime() / 1000, 10)
|
|
35
|
+
r.seconds = d.getSeconds()
|
|
36
|
+
r.minutes = d.getMinutes()
|
|
37
|
+
r.hours = d.getHours()
|
|
38
|
+
r.mday = d.getDate()
|
|
39
|
+
r.wday = w
|
|
40
|
+
r.mon = m + 1
|
|
41
|
+
r.year = y
|
|
42
|
+
r.yday = Math.floor((d - new Date(y, 0, 1)) / 86400000)
|
|
43
|
+
r.weekday = _w[w] + 'day'
|
|
44
|
+
r.month = _m[m]
|
|
45
|
+
r['0'] = parseInt(d.getTime() / 1000, 10)
|
|
31
46
|
|
|
32
|
-
return r
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=getdate.js.map
|
|
47
|
+
return r
|
|
48
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
module.exports = function gettimeofday(returnFloat) {
|
|
4
2
|
// discuss at: https://locutus.io/php/gettimeofday/
|
|
5
3
|
// original by: Brett Zamir (https://brett-zamir.me)
|
|
@@ -13,21 +11,20 @@ module.exports = function gettimeofday(returnFloat) {
|
|
|
13
11
|
// example 2: var $result = $timeStamp > 1000000000 && $timeStamp < 2000000000
|
|
14
12
|
// returns 2: true
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const t = new Date()
|
|
15
|
+
let y = 0
|
|
18
16
|
|
|
19
17
|
if (returnFloat) {
|
|
20
|
-
return t.getTime() / 1000
|
|
18
|
+
return t.getTime() / 1000
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
// Store current year.
|
|
24
|
-
y = t.getFullYear()
|
|
22
|
+
y = t.getFullYear()
|
|
25
23
|
return {
|
|
26
24
|
sec: t.getUTCSeconds(),
|
|
27
25
|
usec: t.getUTCMilliseconds() * 1000,
|
|
28
26
|
minuteswest: t.getTimezoneOffset(),
|
|
29
27
|
// Compare Jan 1 minus Jan 1 UTC to Jul 1 minus Jul 1 UTC to see if DST is observed.
|
|
30
|
-
dsttime: 0 + (new Date(y, 0) - Date.UTC(y, 0) !== new Date(y, 6) - Date.UTC(y, 6))
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=gettimeofday.js.map
|
|
28
|
+
dsttime: 0 + (new Date(y, 0) - Date.UTC(y, 0) !== new Date(y, 6) - Date.UTC(y, 6)),
|
|
29
|
+
}
|
|
30
|
+
}
|
package/php/datetime/gmdate.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function gmdate(format, timestamp) {
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
2
|
+
// discuss at: https://locutus.io/php/gmdate/
|
|
3
|
+
// parity verified: PHP 8.3
|
|
4
|
+
// original by: Brett Zamir (https://brett-zamir.me)
|
|
5
|
+
// input by: Alex
|
|
6
|
+
// bugfixed by: Brett Zamir (https://brett-zamir.me)
|
|
7
|
+
// example 1: gmdate('H:m:s \\m \\i\\s \\m\\o\\n\\t\\h', 1062402400); // Return will depend on your timezone
|
|
8
|
+
// returns 1: '07:09:40 m is month'
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
const date = require('../datetime/date')
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const dt =
|
|
13
|
+
typeof timestamp === 'undefined'
|
|
14
|
+
? new Date() // Not provided
|
|
15
|
+
: timestamp instanceof Date
|
|
16
|
+
? new Date(timestamp) // Javascript Date()
|
|
17
|
+
: new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int)
|
|
16
18
|
|
|
17
|
-
timestamp = Date.parse(dt.toUTCString().slice(0, -4)) / 1000
|
|
19
|
+
timestamp = Date.parse(dt.toUTCString().slice(0, -4)) / 1000
|
|
18
20
|
|
|
19
|
-
return date(format, timestamp)
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=gmdate.js.map
|
|
21
|
+
return date(format, timestamp)
|
|
22
|
+
}
|
package/php/datetime/gmmktime.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function gmmktime() {
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
// discuss at: https://locutus.io/php/gmmktime/
|
|
3
|
+
// parity verified: PHP 8.3
|
|
4
|
+
// original by: Brett Zamir (https://brett-zamir.me)
|
|
5
|
+
// original by: mktime
|
|
6
|
+
// example 1: gmmktime(14, 10, 2, 2, 1, 2008)
|
|
7
|
+
// returns 1: 1201875002
|
|
8
|
+
// example 2: gmmktime(0, 0, -1, 1, 1, 1970)
|
|
9
|
+
// returns 2: -1
|
|
10
|
+
|
|
11
|
+
const d = new Date()
|
|
12
|
+
const r = arguments
|
|
13
|
+
let i = 0
|
|
14
|
+
const e = ['Hours', 'Minutes', 'Seconds', 'Month', 'Date', 'FullYear']
|
|
16
15
|
|
|
17
16
|
for (i = 0; i < e.length; i++) {
|
|
18
17
|
if (typeof r[i] === 'undefined') {
|
|
19
|
-
r[i] = d['getUTC' + e[i]]()
|
|
18
|
+
r[i] = d['getUTC' + e[i]]()
|
|
20
19
|
// +1 to fix JS months.
|
|
21
|
-
r[i] += i === 3
|
|
20
|
+
r[i] += i === 3
|
|
22
21
|
} else {
|
|
23
|
-
r[i] = parseInt(r[i], 10)
|
|
22
|
+
r[i] = parseInt(r[i], 10)
|
|
24
23
|
if (isNaN(r[i])) {
|
|
25
|
-
return false
|
|
24
|
+
return false
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
// Map years 0-69 to 2000-2069 and years 70-100 to 1970-2000.
|
|
31
|
-
r[5] += r[5] >= 0 ? r[5] <= 69 ? 2e3 : r[5] <= 100 ? 1900 : 0 : 0
|
|
30
|
+
r[5] += r[5] >= 0 ? (r[5] <= 69 ? 2e3 : r[5] <= 100 ? 1900 : 0) : 0
|
|
32
31
|
|
|
33
32
|
// Set year, month (-1 to fix JS months), and date.
|
|
34
33
|
// !This must come before the call to setHours!
|
|
35
|
-
d.setUTCFullYear(r[5], r[3] - 1, r[4])
|
|
34
|
+
d.setUTCFullYear(r[5], r[3] - 1, r[4])
|
|
36
35
|
|
|
37
36
|
// Set hours, minutes, and seconds.
|
|
38
|
-
d.setUTCHours(r[0], r[1], r[2])
|
|
37
|
+
d.setUTCHours(r[0], r[1], r[2])
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
const time = d.getTime()
|
|
41
40
|
|
|
42
41
|
// Divide milliseconds by 1000 to return seconds and drop decimal.
|
|
43
42
|
// Add 1 second if negative or it'll be off from PHP by 1 second.
|
|
44
|
-
return (time / 1e3 >> 0) - (time < 0)
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=gmmktime.js.map
|
|
43
|
+
return ((time / 1e3) >> 0) - (time < 0)
|
|
44
|
+
}
|