Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
T
topjs3-demos
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leon Li
topjs3-demos
Commits
0a5abf3b
Commit
0a5abf3b
authored
May 11, 2020
by
l2m2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload.
parent
453844b2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
map-reduce.js
src/es6/map-reduce.js
+10
-0
moment-demo.js
src/moment-demo.js
+13
-8
No files found.
src/es6/map-reduce.js
0 → 100644
View file @
0a5abf3b
let
l
=
[
{
"name"
:
"A"
,
"age"
:
12
},
{
"name"
:
"B"
,
"age"
:
20
},
{
"name"
:
"C"
,
"age"
:
16
},
{
"name"
:
"D"
,
"age"
:
30
},
{
"name"
:
"E"
,
"age"
:
56
},
];
let
result
=
l
.
reduce
(
(
prev
,
curr
)
=>
{
prev
[
curr
.
name
]
=
curr
.
age
;
return
prev
;},
{}
);
console
.
log
(
result
);
\ No newline at end of file
src/moment-demo.js
View file @
0a5abf3b
...
...
@@ -25,14 +25,19 @@ var moment = require("moment");
// print(duration1, duration2, result);
// 求时间的差值
var
start_time
=
"2019-03-31"
;
var
end_time
=
"2019-06-30"
;
print
(
moment
.
VERSION
);
print
(
moment
(
'2020-02-01'
).
add
(
1
,
'months'
));
print
(
moment
(
start_time
).
add
(
3
,
'months'
));
print
(
moment
(
end_time
).
diff
(
moment
(
start_time
),
'months'
,
true
));
print
(
moment
(
start_time
).
add
(
3
,
'months'
).
diff
(
moment
(
start_time
),
'months'
));
print
(
moment
(
start_time
).
add
(
90
,
'days'
).
diff
(
moment
(
start_time
),
'days'
));
// var start_time = "2019-03-31";
// var end_time = "2019-06-30";
// print(moment.VERSION);
// print(moment('2020-02-01').add(1, 'months'));
// print(moment(start_time).add(3, 'months'));
// print(moment(end_time).diff(moment(start_time), 'months', true));
// print(moment(start_time).add(3, 'months').diff(moment(start_time), 'months'));
// print(moment(start_time).add(90, 'days').diff(moment(start_time), 'days'));
var
start_time
=
'2020-05-09 14:30:00'
;
var
end_time
=
'2020-05-09 14:00:00'
;
var
d
=
moment
(
start_time
).
diff
(
end_time
,
'minutes'
);
print
(
d
>=
30
);
// 取整点
// var start_time = "2019-07-08 23:45:09";
...
...
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