Skip to content

Commit aeeb791

Browse files
author
linzhijun
committed
修改
1 parent 8e86613 commit aeeb791

File tree

10 files changed

+14
-13
lines changed

10 files changed

+14
-13
lines changed

csharp/ToolGood.Algorithm.WebAssembly/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static bool TryEvaluateBool(string exp, bool def, string data = null, str
8080
}
8181

8282
[JSInvokable]
83-
public static DateTime TryEvaluateDateTime(string exp, DateTime def, string data = null, string option = null)
83+
public static string TryEvaluateDateTime(string exp, DateTime def, string data = null, string option = null)
8484
{
8585
AlgorithmEngine ae;
8686
if (option == null) {
@@ -99,7 +99,7 @@ public static DateTime TryEvaluateDateTime(string exp, DateTime def, string data
9999
if (data != null) {
100100
ae.AddParameterFromJson(data);
101101
}
102-
return ae.TryEvaluate(exp, def);
102+
return ae.TryEvaluate(exp, def).ToString("yyyy-MM-dd HH:mm:ss");
103103
}
104104

105105

csharp/ToolGood.Algorithm2.WebTest/Pages/Test.cshtml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
5151
5252
var e = engine.TryEvaluate("e", 0.0);
53-
assert.equal(Math.E, e, 11);
53+
assert.equal(Math.round(Math.E, 10), Math.round(e, 10));
5454
e = engine.TryEvaluate("pi", 0.0);
55-
assert.equal(Math.PI, e, 11);
55+
assert.equal(Math.round(Math.PI, 10), Math.round(e, 10));
5656
5757
var b = engine.TryEvaluate("true", false);
5858
assert.equal(true, b);
@@ -66,9 +66,9 @@
6666
assert.equal(2, b1);
6767
6868
var b2 = engine.TryEvaluate("pi*4", 0.0);
69-
assert.equal(Math.PI * 4, b2, 10);
69+
assert.equal(Math.round(Math.PI * 4, 10), Math.round(b2, 10));
7070
b2 = engine.TryEvaluate("e*4", 0.0);
71-
assert.equal(Math.E * 4, b2, 10);
71+
assert.equal(Math.round(Math.E * 4, 10), Math.round(b2, 10));
7272
7373
var s = engine.TryEvaluate("'aa'&'bb'", "");
7474
assert.equal("aabb", s);
@@ -86,9 +86,10 @@
8686
assert.equal(2, r);;
8787
8888
var dt = engine.TryEvaluate("'2016-1-1'+1", new Date());
89-
assert.equal(new Date("2016-1-2"), dt);
89+
assert.equal("2016-01-02 00:00:00", dt);
9090
dt = engine.TryEvaluate("'2016-1-1'+9*'1:0'", new Date());
91-
assert.equal(new Date("2016-1-1 9:0"), dt);;
91+
assert.equal("2016-01-01 09:00:00", dt);
92+
9293
9394
var value = engine.TryEvaluate("1 > (-2)", false);
9495
assert.equal(value, true);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

csharp/ToolGood.Algorithm2.WebTest/wwwroot/_framework/blazor.boot.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"mainAssemblyName": "ToolGood.Algorithm.WebAssembly",
33
"resources": {
4-
"hash": "sha256-rnRmRrfkasTXs0ufkFvB4PW1GM+8htymKTN3PhAZvlo=",
4+
"hash": "sha256-+6jR/+4mhj6IYlEaRHA5fixqeML72rqIBxlvRpfZsaY=",
55
"jsModuleNative": {
66
"dotnet.native.8.0.4.rkw194kvb3.js": "sha256-ju0+XWE0ihz554eKEj0HQ8Opa61xpbUIaX5/MNo8we4="
77
},
@@ -209,12 +209,12 @@
209209
"mscorlib.wasm": "sha256-VCfYgt1mcjITabSTosCDVZ+68ea3Z7kakTFaLNLG+18=",
210210
"netstandard.wasm": "sha256-YOZxxR9PM3Dltcijfb0Q4FD39DkWZbZ1e2ScbZDvWJ4=",
211211
"System.Private.CoreLib.wasm": "sha256-NrT1QkAzVU//2wgK9vXdq77lCGvLJ4IOZ+Aegesyanc=",
212-
"ToolGood.Algorithm.wasm": "sha256-bC/eP0ZrFQ2n8TIzFlE2Fy7Wf5be+mkv2OOPtwRSgrg=",
213-
"ToolGood.Algorithm.WebAssembly.wasm": "sha256-sYil+QMGlnnyzX4T22sDpkc75/ygx4HeMlUr3m8SyB0="
212+
"ToolGood.Algorithm.wasm": "sha256-CfDWYV2K9/n7chBK3fwN31VUi/kT+gZKG7Ty+dq2pEE=",
213+
"ToolGood.Algorithm.WebAssembly.wasm": "sha256-EWod2UabayYFT5UPii9TsFu2sh90lVC5jGtM4YeD2cY="
214214
},
215215
"pdb": {
216-
"ToolGood.Algorithm.pdb": "sha256-h7jLgt9uwB47aBSX0cZOxGImlmzGk6aO1qlnpdr7fZc=",
217-
"ToolGood.Algorithm.WebAssembly.pdb": "sha256-jQA2DLoTcuJJkR2XJIxWtZosTy3xqD68Ecajdc9DavM="
216+
"ToolGood.Algorithm.pdb": "sha256-/RAmiQrZkOcWJewe8uXuncwBeEMEMeTBXOkpw6WwB8M=",
217+
"ToolGood.Algorithm.WebAssembly.pdb": "sha256-0DIQ1pqepWsS/etk568iKUnz03OVB4IW8Av9gG+wLQk="
218218
}
219219
},
220220
"cacheBootResources": true,
Binary file not shown.

0 commit comments

Comments
 (0)