Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GGCE
GGCE Web
Commits
e98aad46
Commit
e98aad46
authored
May 03, 2022
by
Maksym Tishchenko
Browse files
DateFilter fix format parsing
parent
332c9526
Changes
1
Hide whitespace changes
Inline
Side-by-side
workspaces/ui-express/src/ui/common/filter/DateFilter.tsx
View file @
e98aad46
...
...
@@ -38,7 +38,7 @@ interface IDateFilter extends FieldProps<any, any> {
endAdornment
?:
any
;
}
const
validateDateFilter
=
(
val
)
=>
!
val
||
DateTime
.
from
Format
(
val
,
'
yyyy-MM-dd
'
).
isValid
?
undefined
:
'
Must be a valid date
'
;
const
validateDateFilter
=
(
val
)
=>
!
val
||
DateTime
.
from
ISO
(
val
).
isValid
?
undefined
:
'
Must be a valid date
'
;
const
DateFilter
=
({
name
,
label
,
endAdornment
,
...
other
}:
IDateFilter
)
=>
{
...
...
@@ -53,7 +53,7 @@ const DateFilter = ({ name, label, endAdornment, ...other }: IDateFilter) => {
const
valueLe
=
getFieldState
(
`
${
name
}
.le`
).
value
;
// console.log(`DateFilter, valueGe: ${valueGe}, valueLe: ${valueLe}`)
if
(
valueGe
&&
valueLe
&&
DateTime
.
from
Format
(
valueGe
,
'
yyyy-MM-dd
'
)
>
(
DateTime
.
from
Format
(
valueLe
,
'
yyyy-MM-dd
'
)))
{
if
(
valueGe
&&
valueLe
&&
DateTime
.
from
ISO
(
valueGe
)
>
(
DateTime
.
from
ISO
(
valueLe
)))
{
// console.log('DateFilter, swapping')
change
(
`
${
name
}
.le`
,
valueGe
);
change
(
`
${
name
}
.ge`
,
valueLe
);
...
...
Write
Preview
Supports
Markdown
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