Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-task
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3dd1534b
authored
Oct 31, 2022
by
xuyl
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
上一个月日期处理
1 parent
584255be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
src/mixin/nearlyAMonth.js
src/mixin/nearlyAMonth.js
View file @
3dd1534
export
const
nearlyAMonth
=
{
data
(){
return
{
defalutStartTime
:
''
,
defalutEndTime
:
''
data
()
{
return
{
defalutStartTime
:
''
,
defalutEndTime
:
''
}
},
created
()
{
...
...
@@ -11,7 +11,19 @@ export const nearlyAMonth = {
let
month
=
date
.
getMonth
()
+
1
let
day
=
date
.
getDate
()
let
aheadOfMonth
=
month
==
'1'
?
'12'
:
month
-
1
this
.
defalutStartTime
=
year
+
'-'
+
aheadOfMonth
+
'-'
+
day
let
preDays
=
this
.
mGetDate
(
year
,
aheadOfMonth
)
// let curDays = this.mGetDate(year, month)
this
.
defalutEndTime
=
year
+
'-'
+
month
+
'-'
+
day
if
(
day
>
preDays
)
{
this
.
defalutStartTime
=
year
+
'-'
+
aheadOfMonth
+
'-'
+
preDays
}
else
{
this
.
defalutStartTime
=
year
+
'-'
+
aheadOfMonth
+
'-'
+
day
}
},
methods
:
{
mGetDate
(
year
,
month
)
{
let
d
=
new
Date
(
year
,
month
,
0
)
return
d
.
getDate
()
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment