Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
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
Vũ Hoàng Anh
canifa_note
Commits
319f679e
Commit
319f679e
authored
Sep 10, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix timestamp type
parent
b6d1ded6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
20 deletions
+16
-20
DatePicker.tsx
web/src/components/kit/DatePicker.tsx
+6
-6
datetime.ts
web/src/helpers/datetime.ts
+1
-1
DailyReview.tsx
web/src/pages/DailyReview.tsx
+1
-1
common.d.ts
web/src/types/common.d.ts
+0
-4
memo.d.ts
web/src/types/modules/memo.d.ts
+4
-4
resource.d.ts
web/src/types/modules/resource.d.ts
+2
-2
user.d.ts
web/src/types/modules/user.d.ts
+2
-2
No files found.
web/src/components/kit/DatePicker.tsx
View file @
319f679e
...
@@ -12,14 +12,14 @@ import "@/less/common/date-picker.less";
...
@@ -12,14 +12,14 @@ import "@/less/common/date-picker.less";
interface
DatePickerProps
{
interface
DatePickerProps
{
className
?:
string
;
className
?:
string
;
isFutureDateDisabled
?:
boolean
;
isFutureDateDisabled
?:
boolean
;
datestamp
:
DateStamp
;
datestamp
:
number
;
handleDateStampChange
:
(
datestamp
:
DateStamp
)
=>
void
;
handleDateStampChange
:
(
datestamp
:
number
)
=>
void
;
}
}
const
DatePicker
:
React
.
FC
<
DatePickerProps
>
=
(
props
:
DatePickerProps
)
=>
{
const
DatePicker
:
React
.
FC
<
DatePickerProps
>
=
(
props
:
DatePickerProps
)
=>
{
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
{
className
,
isFutureDateDisabled
,
datestamp
,
handleDateStampChange
}
=
props
;
const
{
className
,
isFutureDateDisabled
,
datestamp
,
handleDateStampChange
}
=
props
;
const
[
currentDateStamp
,
setCurrentDateStamp
]
=
useState
<
DateStamp
>
(
getMonthFirstDayDateStamp
(
datestamp
));
const
[
currentDateStamp
,
setCurrentDateStamp
]
=
useState
<
number
>
(
getMonthFirstDayDateStamp
(
datestamp
));
const
[
countByDate
,
setCountByDate
]
=
useState
(
new
Map
());
const
[
countByDate
,
setCountByDate
]
=
useState
(
new
Map
());
const
currentUsername
=
useUserStore
().
getCurrentUsername
();
const
currentUsername
=
useUserStore
().
getCurrentUsername
();
...
@@ -55,7 +55,7 @@ const DatePicker: React.FC<DatePickerProps> = (props: DatePickerProps) => {
...
@@ -55,7 +55,7 @@ const DatePicker: React.FC<DatePickerProps> = (props: DatePickerProps) => {
});
});
}
}
const
handleDateItemClick
=
(
datestamp
:
DateStamp
)
=>
{
const
handleDateItemClick
=
(
datestamp
:
number
)
=>
{
handleDateStampChange
(
datestamp
);
handleDateStampChange
(
datestamp
);
};
};
...
@@ -122,7 +122,7 @@ const DatePicker: React.FC<DatePickerProps> = (props: DatePickerProps) => {
...
@@ -122,7 +122,7 @@ const DatePicker: React.FC<DatePickerProps> = (props: DatePickerProps) => {
);
);
};
};
function
getMonthDayAmount
(
datestamp
:
DateStamp
):
number
{
function
getMonthDayAmount
(
datestamp
:
number
):
number
{
const
dateTemp
=
new
Date
(
datestamp
);
const
dateTemp
=
new
Date
(
datestamp
);
const
currentDate
=
new
Date
(
`
${
dateTemp
.
getFullYear
()}
/
${
dateTemp
.
getMonth
()
+
1
}
/1`
);
const
currentDate
=
new
Date
(
`
${
dateTemp
.
getFullYear
()}
/
${
dateTemp
.
getMonth
()
+
1
}
/1`
);
const
nextMonthDate
=
const
nextMonthDate
=
...
@@ -133,7 +133,7 @@ function getMonthDayAmount(datestamp: DateStamp): number {
...
@@ -133,7 +133,7 @@ function getMonthDayAmount(datestamp: DateStamp): number {
return
(
nextMonthDate
.
getTime
()
-
currentDate
.
getTime
())
/
DAILY_TIMESTAMP
;
return
(
nextMonthDate
.
getTime
()
-
currentDate
.
getTime
())
/
DAILY_TIMESTAMP
;
}
}
function
getMonthFirstDayDateStamp
(
timestamp
:
TimeStamp
):
DateStamp
{
function
getMonthFirstDayDateStamp
(
timestamp
:
number
):
number
{
const
dateTemp
=
new
Date
(
timestamp
);
const
dateTemp
=
new
Date
(
timestamp
);
const
currentDate
=
new
Date
(
`
${
dateTemp
.
getFullYear
()}
/
${
dateTemp
.
getMonth
()
+
1
}
/1`
);
const
currentDate
=
new
Date
(
`
${
dateTemp
.
getFullYear
()}
/
${
dateTemp
.
getMonth
()
+
1
}
/1`
);
return
currentDate
.
getTime
();
return
currentDate
.
getTime
();
...
...
web/src/helpers/datetime.ts
View file @
319f679e
...
@@ -5,7 +5,7 @@ export function convertToMillis(localSetting: LocalSetting) {
...
@@ -5,7 +5,7 @@ export function convertToMillis(localSetting: LocalSetting) {
return
hoursToMillis
;
return
hoursToMillis
;
}
}
export
function
getTimeStampByDate
(
t
:
Date
|
number
|
string
):
number
{
export
function
getTimeStampByDate
(
t
:
Date
|
number
|
string
|
any
):
number
{
return
new
Date
(
t
).
getTime
();
return
new
Date
(
t
).
getTime
();
}
}
...
...
web/src/pages/DailyReview.tsx
View file @
319f679e
...
@@ -83,7 +83,7 @@ const DailyReview = () => {
...
@@ -83,7 +83,7 @@ const DailyReview = () => {
});
});
};
};
const
handleDataPickerChange
=
(
datestamp
:
DateStamp
):
void
=>
{
const
handleDataPickerChange
=
(
datestamp
:
number
):
void
=>
{
setCurrentDateStamp
(
datestamp
);
setCurrentDateStamp
(
datestamp
);
toggleShowDatePicker
(
false
);
toggleShowDatePicker
(
false
);
};
};
...
...
web/src/types/common.d.ts
View file @
319f679e
type
BasicType
=
undefined
|
null
|
boolean
|
number
|
string
|
Record
<
string
,
unknown
>
|
Array
<
BasicType
>
;
type
BasicType
=
undefined
|
null
|
boolean
|
number
|
string
|
Record
<
string
,
unknown
>
|
Array
<
BasicType
>
;
type
DateStamp
=
number
;
type
TimeStamp
=
number
;
type
FunctionType
=
(...
args
:
unknown
[])
=>
unknown
;
type
FunctionType
=
(...
args
:
unknown
[])
=>
unknown
;
interface
KVObject
<
T
=
any
>
{
interface
KVObject
<
T
=
any
>
{
...
...
web/src/types/modules/memo.d.ts
View file @
319f679e
...
@@ -6,11 +6,11 @@ interface Memo {
...
@@ -6,11 +6,11 @@ interface Memo {
id
:
MemoId
;
id
:
MemoId
;
creatorUsername
:
string
;
creatorUsername
:
string
;
createdTs
:
TimeStamp
;
createdTs
:
number
;
updatedTs
:
TimeStamp
;
updatedTs
:
number
;
rowStatus
:
RowStatus
;
rowStatus
:
RowStatus
;
displayTs
:
TimeStamp
;
displayTs
:
number
;
content
:
string
;
content
:
string
;
visibility
:
Visibility
;
visibility
:
Visibility
;
pinned
:
boolean
;
pinned
:
boolean
;
...
@@ -29,7 +29,7 @@ interface MemoCreate {
...
@@ -29,7 +29,7 @@ interface MemoCreate {
interface
MemoPatch
{
interface
MemoPatch
{
id
:
MemoId
;
id
:
MemoId
;
createdTs
?:
TimeStamp
;
createdTs
?:
number
;
rowStatus
?:
RowStatus
;
rowStatus
?:
RowStatus
;
content
?:
string
;
content
?:
string
;
resourceIdList
?:
ResourceId
[];
resourceIdList
?:
ResourceId
[];
...
...
web/src/types/modules/resource.d.ts
View file @
319f679e
...
@@ -3,8 +3,8 @@ type ResourceId = number;
...
@@ -3,8 +3,8 @@ type ResourceId = number;
interface
Resource
{
interface
Resource
{
id
:
ResourceId
;
id
:
ResourceId
;
createdTs
:
TimeStamp
;
createdTs
:
number
;
updatedTs
:
TimeStamp
;
updatedTs
:
number
;
filename
:
string
;
filename
:
string
;
externalLink
:
string
;
externalLink
:
string
;
...
...
web/src/types/modules/user.d.ts
View file @
319f679e
...
@@ -4,8 +4,8 @@ type UserRole = "HOST" | "USER";
...
@@ -4,8 +4,8 @@ type UserRole = "HOST" | "USER";
interface
User
{
interface
User
{
id
:
UserId
;
id
:
UserId
;
createdTs
:
TimeStamp
;
createdTs
:
number
;
updatedTs
:
TimeStamp
;
updatedTs
:
number
;
rowStatus
:
RowStatus
;
rowStatus
:
RowStatus
;
username
:
string
;
username
:
string
;
...
...
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