Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TF-MOM-WEB
Project
Project
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
TFMOM
TF-MOM-WEB
Commits
aa5f441c
Commit
aa5f441c
authored
Sep 13, 2024
by
jingnan
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加计算两个日期时间字符串的时间差的方法
parent
b686fd75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
util.js
applications/architecture-dee/src/utils/util.js
+18
-1
No files found.
applications/architecture-dee/src/utils/util.js
View file @
aa5f441c
...
@@ -1701,6 +1701,22 @@ export function addMinutes(date, minutes) {
...
@@ -1701,6 +1701,22 @@ export function addMinutes(date, minutes) {
const resDate= formatDate(dateFormat, 'YYYY-MM-DD HH:mm:ss')
const resDate= formatDate(dateFormat, 'YYYY-MM-DD HH:mm:ss')
return resDate
return resDate
}
}
/**
* 计算两个日期时间字符串的时间差(单位:分钟)
* @param {*} dateTimeStr1
* @param {*} dateTimeStr2
* @returns
*/
export function getTimeDifferenceInMinutes(dateTimeStr1, dateTimeStr2) {
const date1 = new Date(dateTimeStr1)
const date2 = new Date(dateTimeStr2)
if (isNaN(date1.getTime()) || isNaN(date2.getTime())) {
throw new Error('无效的日期时间字符串')
}
const differenceInMilliseconds = Math.abs(date2 - date1) // 使用Math.abs获取绝对值,确保总是正数
const differenceInSeconds = differenceInMilliseconds / (1000 * 60)
return differenceInSeconds
}
export default {
export default {
findByNameVnode,
findByNameVnode,
...
@@ -1795,5 +1811,6 @@ export default {
...
@@ -1795,5 +1811,6 @@ export default {
subNum,
subNum,
getTargetJobResponses,
getTargetJobResponses,
export_excel,
export_excel,
addMinutes
addMinutes,
getTimeDifferenceInMinutes
}
}
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