You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'timestamp': {description: 'Timestamp to use (ISO 8601 formats)',type: 'number',coerce(value: any){constts=moment(value,moment.ISO_8601,true);if(!ts.isValid()){process.exitCode=1;thrownewError(`Cannot parse provided timestamp ${value}`);}returnts.valueOf();},},
Somehow this started to break "recently", and complains about the value inside coerce being NaN, when the value provided to the option is something like this: 2021-01-21 17:25:47.
ISTR that this used to work in processing the value correctly, but looking at the sources I see that yargs-parser's processValue is executed before applyCoercions.
Now, I can get the behavior I need by changing the type to string, but before doing that: Is this "intentional", i.e. is the type intended to mean "type before it gets to coerce", rather than "type after it has been coerced?"
The text was updated successfully, but these errors were encountered:
I just tested with various yargs versions, and I have to take that back: This never seems to have worked.
Test script was broken, after fixing it the change seems to have appeared between yargs 14.0.0 and yargs 14.1.0. "Recently" might be a problem somewhere else -- my library depends on yargs@13, but I see that npm found a way to install yargs@15 in the project where things break.
I have an option definition like this:
Somehow this started to break "recently", and complains about the
value
inside coerce beingNaN
, when the value provided to the option is something like this:2021-01-21 17:25:47
.ISTR that this used to work in processing the value correctly, but looking at the sources I see that yargs-parser's
processValue
is executed beforeapplyCoercions
.Now, I can get the behavior I need by changing the type to
string
, but before doing that: Is this "intentional", i.e. is thetype
intended to mean "type before it gets to coerce", rather than "type after it has been coerced?"The text was updated successfully, but these errors were encountered: