Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjinjing
shouzhouServer
Commits
15340644
Commit
15340644
authored
Jul 18, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日期格式
parent
04571970
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
abstractDataStrategyRight.ts
src/biz/strategies/right/abstractDataStrategyRight.ts
+10
-1
eventMonthDistributionStrategy.ts
src/biz/strategies/right/eventMonthDistributionStrategy.ts
+8
-1
getEventCountByYearStrategy.ts
src/biz/strategies/right/getEventCountByYearStrategy.ts
+11
-3
No files found.
src/biz/strategies/right/abstractDataStrategyRight.ts
View file @
15340644
...
...
@@ -82,7 +82,16 @@ protected getListCount(list: string[], target: string, data: any, year: string)
const
count
=
this
.
registerItems
(
list
);
data
.
forEach
(
row
=>
{
const
rowDate
=
excelSerialToJSDate
(
row
[
'创建时间'
]);
// const rowDate = excelSerialToJSDate(row['创建时间']);
let
rowDate
:
any
=
0
;
if
(
typeof
(
row
[
'创建时间'
])
==
"number"
)
{
rowDate
=
excelSerialToJSDate
(
row
[
'创建时间'
]);
// console.log("from if", row['创建时间']);
}
else
{
rowDate
=
row
[
'创建时间'
];
// console.log(rowDate);
}
const
rowYear
=
rowDate
.
getFullYear
();
if
(
rowYear
==
targetYear
)
{
count
.
set
(
row
[
target
],
(
count
.
get
(
row
[
target
])
||
0
)
+
1
);
...
...
src/biz/strategies/right/eventMonthDistributionStrategy.ts
View file @
15340644
...
...
@@ -31,6 +31,7 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
* @returns 事件按月分布计数的映射。
*/
private
getEventMonthDistribution
(
data
:
any
,
year
:
string
)
{
const
currentYear
=
new
Date
().
getFullYear
();
const
targetYear
=
year
===
'thisyear'
?
currentYear
:
currentYear
-
1
;
...
...
@@ -41,7 +42,13 @@ export class eventMonthDistributionStrategy extends abstractDataStrategyRight {
}
data
.
forEach
(
row
=>
{
const
rowDate
=
excelSerialToJSDate
(
row
[
'创建时间'
]);
let
rowDate
:
any
=
0
;
if
(
typeof
(
row
[
'创建时间'
])
==
"number"
)
{
rowDate
=
excelSerialToJSDate
(
row
[
'创建时间'
]);
}
else
{
rowDate
=
row
[
'创建时间'
];
}
rowDate
.
setHours
(
rowDate
.
getHours
()
-
eventMonthDistributionStrategy
.
TIMEDIFFERENCE
);
const
rowYear
=
rowDate
.
getFullYear
();
const
rowMonth
=
rowDate
.
getMonth
()
+
1
;
// getMonth() returns 0-11
...
...
src/biz/strategies/right/getEventCountByYearStrategy.ts
View file @
15340644
...
...
@@ -42,8 +42,16 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
data
.
forEach
(
row
=>
{
const
rawDate
=
row
[
'创建时间'
];
const
rowDate
=
excelSerialToJSDate
(
rawDate
);
// const rowDate = excelSerialToJSDate(rawDate);
let
rowDate
:
any
=
0
;
if
(
typeof
(
row
[
'创建时间'
])
==
"number"
)
{
rowDate
=
excelSerialToJSDate
(
row
[
'创建时间'
]);
console
.
log
(
"from if"
,
row
[
'创建时间'
]);
}
else
{
rowDate
=
row
[
'创建时间'
];
console
.
log
(
rowDate
);
}
let
rowYear
=
0
;
if
(
!
isNaN
(
rowDate
.
getTime
()))
{
try
{
...
...
@@ -53,7 +61,7 @@ export class getEventCountByYearStrategy extends abstractDataStrategyRight {
console
.
log
(
'Error getting year:'
,
e
);
}
}
else
{
console
.
log
(
'Invalid Date:'
,
rawDate
.
getTime
());
//
console.log('Invalid Date:', rawDate.getTime());
}
if
(
rowYear
==
targetYear
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment