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 [isBefore, setBefore] = useState(false)
|
||||||
const [value, setValue] = useState("")
|
const [value, setValue] = useState("")
|
||||||
|
const [disabled, setDisabled] = useState(true)
|
||||||
|
|
||||||
const _onSubmit = event => {
|
const _onSubmit = event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
if(!value) {
|
if(!value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.debug(value)
|
|
||||||
submit(new TimeRay(isBefore, new Date(value)))
|
submit(new TimeRay(isBefore, new Date(value)))
|
||||||
setValue("")
|
setValue("")
|
||||||
}
|
}
|
||||||
|
|
||||||
const _onChange = event => {
|
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 (
|
return (
|
||||||
|
@ -71,7 +73,7 @@ export default function FormInlineTimeRay(
|
||||||
icon={buttonIcon}
|
icon={buttonIcon}
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
onClick={_onSubmit}
|
onClick={_onSubmit}
|
||||||
disabled={!value}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
</FormInline>
|
</FormInline>
|
||||||
)
|
)
|
||||||
|
|
|
@ -211,7 +211,6 @@ export class FilterInsideTimeRay extends Filter {
|
||||||
}
|
}
|
||||||
|
|
||||||
check(tweet) {
|
check(tweet) {
|
||||||
console.debug(this.timeRay.date, tweet["post_time"])
|
|
||||||
return this.timeRay.includes(new Date(tweet["post_time"]))
|
return this.timeRay.includes(new Date(tweet["post_time"]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,6 @@ export default class TimeRay {
|
||||||
}
|
}
|
||||||
|
|
||||||
includes(date) {
|
includes(date) {
|
||||||
return Boolean((
|
return Boolean((date > this.date) ^ this.isBefore)
|
||||||
this.date > date
|
|
||||||
) ^ this.isBefore)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue