mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-24 05:54:18 +00:00
🐛 Fix even more bugs
This commit is contained in:
parent
f478fc8434
commit
89bdce3ded
3 changed files with 6 additions and 7 deletions
|
@ -37,19 +37,21 @@ export default function FormInlineTimeRay(
|
|||
) {
|
||||
const [isBefore, setBefore] = useState(false)
|
||||
const [value, setValue] = useState("")
|
||||
const [disabled, setDisabled] = useState(true)
|
||||
|
||||
const _onSubmit = event => {
|
||||
event.preventDefault()
|
||||
if(!value) {
|
||||
return
|
||||
}
|
||||
console.debug(value)
|
||||
submit(new TimeRay(isBefore, new Date(value)))
|
||||
setValue("")
|
||||
}
|
||||
|
||||
const _onChange = event => {
|
||||
setValue(validate(event.target.value.toUpperCase().replace(INVALID_CHARACTERS, "")))
|
||||
const newValue = validate(event.target.value.toUpperCase().replace(INVALID_CHARACTERS, ""))
|
||||
setValue(newValue)
|
||||
setDisabled(!value || isNaN(new Date(newValue).getDate()))
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -71,7 +73,7 @@ export default function FormInlineTimeRay(
|
|||
icon={buttonIcon}
|
||||
color={buttonColor}
|
||||
onClick={_onSubmit}
|
||||
disabled={!value}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</FormInline>
|
||||
)
|
||||
|
|
|
@ -211,7 +211,6 @@ export class FilterInsideTimeRay extends Filter {
|
|||
}
|
||||
|
||||
check(tweet) {
|
||||
console.debug(this.timeRay.date, tweet["post_time"])
|
||||
return this.timeRay.includes(new Date(tweet["post_time"]))
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ export default class TimeRay {
|
|||
}
|
||||
|
||||
includes(date) {
|
||||
return Boolean((
|
||||
this.date > date
|
||||
) ^ this.isBefore)
|
||||
return Boolean((date > this.date) ^ this.isBefore)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue