-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timex function for hasFullDate and hasValidHour builtin-functions #3780
Conversation
return (value, error); | ||
}, | ||
ReturnType.Boolean, | ||
expr => ValidateArityAndAnyType(expr, 1, 1, ReturnType.Object)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateArityAndAnyType(expr, 1, 1, ReturnType.Object) [](start = 28, length = 54)
You can validate to object | string, right? Numbers or arrays are not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these two functions can have a string or a TimexProperty as an argument.
Here ReturnType.Object represents a base type which includes string, number and boolean, etc.
The actual type checking is in the body of functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our ReturnType.Object today actually works like a any
not a object
, so object | number won't be able to reject number or array, so we probably can refine the type checking types later.
return (value, error); | ||
}, | ||
ReturnType.Boolean, | ||
expr => ValidateArityAndAnyType(expr, 1, 1, ReturnType.Object)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alidateArityAndAnyType(expr, 1, 1, ReturnType.Object)), [](start = 29, length = 55)
same comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
Why not hasValidX for other things like month/day/year/minute/duration? If I said "when do you want to leave" and got a response of "the 30th", I might want to check for not having a month for example. In reply to: 399361646 [](ancestors = 399361646) |
@vishwacsena |
@cosmicshuai yes, we can always take that as an additive change. Are you suggesting we do it instead of this one? If so, I'd only be concerned about scoping it (which is what the trimmed proposal here was supposed to be). My vote would be for us to add these now and add the generic function to the backlog. Ok? |
@vishwacsena |
I'm not sure I buy this. While it lessens the risk for now, it comes at the cost of adding more functions which overlap--doesn't seem like a good tradeoff to me. In reply to: 618771234 [](ancestors = 618771234) |
@chrimc62 @vishwacsena |
I like keeping the names the same. In reply to: 620470357 [](ancestors = 620470357) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closes: #2869
Now we have 7 timex related functions:
HasFullDate, HasValidTime, HasValidDuration, HasValidDate, HasValidTimeRange, HasValidDateRange, IsPresent