Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ebbb6725
authored
Sep 06, 2021
by
杨铁龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化时间格式化
parent
512a7138
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
utils/time/index.ts
utils/time/index.ts
View file @
ebbb6725
...
...
@@ -156,13 +156,15 @@ function formatTime2ShortYearMonthDate(time: Date) {
* @param option { rule: 选择是12小时制还是24小时制,short:是否以短时间形式显示 }
*/
export
function
formatTime
(
time
:
number
,
time
:
number
|
string
,
option
=
{
rule
:
TimeFormatRule
.
Hour12
,
short
:
false
}
)
{
if
(
time
<
STANDARD
)
{
time
*=
1000
;
if
(
String
(
time
).
indexOf
(
"-"
))
{
time
=
String
(
time
).
replace
(
/-/g
,
"/"
);
}
if
(
/^
\d
+$/
.
test
(
time
+
''
)
&&
+
time
<
STANDARD
)
{
time
=
+
time
*
1000
;
}
const
t
=
new
Date
(
time
);
const
now
=
new
Date
();
...
...
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