diff options
-rw-r--r-- | fxjs/cjs_publicmethods.cpp | 15 | ||||
-rw-r--r-- | fxjs/cjs_publicmethods.h | 11 |
2 files changed, 13 insertions, 13 deletions
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp index 4ccd00d554..10ddf2254b 100644 --- a/fxjs/cjs_publicmethods.cpp +++ b/fxjs/cjs_publicmethods.cpp @@ -412,8 +412,8 @@ WideString CJS_PublicMethods::ParseStringString(const WideString& str, return swRet; } -double CJS_PublicMethods::ParseNormalDate(const WideString& value, - bool* bWrongFormat) { +double CJS_PublicMethods::ParseDate(const WideString& value, + bool* bWrongFormat) { double dt = JS_GetDateTime(); int nYear = JS_GetYearFromTime(dt); @@ -736,7 +736,7 @@ double CJS_PublicMethods::ParseDateUsingFormat(const WideString& value, double dRet; if (bBadFormat) { - dRet = ParseNormalDate(value, &bBadFormat); + dRet = ParseDate(value, &bBadFormat); } else { dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay), JS_MakeTime(nHour, nMin, nSec, 0)); @@ -745,7 +745,7 @@ double CJS_PublicMethods::ParseDateUsingFormat(const WideString& value, } if (std::isnan(dRet)) - dRet = ParseNormalDate(value, &bBadFormat); + dRet = ParseDate(value, &bBadFormat); if (bWrongFormat) *bWrongFormat = bBadFormat; @@ -1191,9 +1191,8 @@ CJS_Result CJS_PublicMethods::AFDate_FormatEx( WideString sFormat = pRuntime->ToWideString(params[0]); double dDate; if (strValue.Contains(L"GMT")) { - // for GMT format time - // such as "Tue Aug 11 14:24:16 GMT+08002009" - dDate = MakeInterDate(strValue); + // e.g. "Tue Aug 11 14:24:16 GMT+08002009" + dDate = ParseDateAsGMT(strValue); } else { dDate = ParseDateUsingFormat(strValue, sFormat, nullptr); } @@ -1209,7 +1208,7 @@ CJS_Result CJS_PublicMethods::AFDate_FormatEx( return CJS_Result::Success(); } -double CJS_PublicMethods::MakeInterDate(const WideString& strValue) { +double CJS_PublicMethods::ParseDateAsGMT(const WideString& strValue) { std::vector<WideString> wsArray; WideString sTemp; for (const auto& c : strValue) { diff --git a/fxjs/cjs_publicmethods.h b/fxjs/cjs_publicmethods.h index 0b72fb3e0a..99720ada39 100644 --- a/fxjs/cjs_publicmethods.h +++ b/fxjs/cjs_publicmethods.h @@ -18,6 +18,9 @@ class CJS_PublicMethods final : public CJS_Object { ~CJS_PublicMethods() override; static void DefineJSObjects(CFXJS_Engine* pEngine); + + static double ParseDate(const WideString& value, bool* bWrongFormat); + static double ParseDateAsGMT(const WideString& value); static double ParseDateUsingFormat(const WideString& value, const WideString& format, bool* bWrongFormat); @@ -137,7 +140,6 @@ class CJS_PublicMethods final : public CJS_Object { static void AFExtractNums_static( const v8::FunctionCallbackInfo<v8::Value>& info); - static const JSMethodSpec GlobalFunctionSpecs[]; static int ParseStringInteger(const WideString& str, size_t nStart, size_t* pSkip, @@ -145,17 +147,16 @@ class CJS_PublicMethods final : public CJS_Object { static WideString ParseStringString(const WideString& str, size_t nStart, size_t* pSkip); - static double ParseNormalDate(const WideString& value, bool* bWrongFormat); - static double MakeInterDate(const WideString& value); - static bool MaskSatisfied(wchar_t c_Change, wchar_t c_Mask); static bool IsReservedMaskChar(wchar_t ch); - static double AF_Simple(const wchar_t* sFuction, double dValue1, double dValue2); static v8::Local<v8::Array> AF_MakeArrayFromList(CJS_Runtime* pRuntime, v8::Local<v8::Value> val); + + private: + static const JSMethodSpec GlobalFunctionSpecs[]; }; #endif // FXJS_CJS_PUBLICMETHODS_H_ |