1
Fork 0
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:
Steffo 2021-05-30 17:59:31 +02:00
parent f478fc8434
commit 89bdce3ded
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 6 additions and 7 deletions

View file

@ -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>
)

View file

@ -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"]))
}

View file

@ -38,8 +38,6 @@ export default class TimeRay {
}
includes(date) {
return Boolean((
this.date > date
) ^ this.isBefore)
return Boolean((date > this.date) ^ this.isBefore)
}
}