Steps to repro:
https://github.com/pnp/office365-cli/blob/d0cc2b201286d5ae944cae3c86c9808b5e4d9491/src/Utils.ts#L83
Actual:
This line will stop working once the date becomes DD-MM-2021 since the regex is 19|20
Expected:
To work in 2021
Testing iso format date only with dashes works for me. The 19|20 is only meant to match the beginning of a 4 digit year and can be followed by any 2 additional digits. Am I understanding this correctly?
2021-10-10 passes regex.
@DaveCalGH, I have not idea of what this regex is doing to be honest. I saw 19|20 and that seemed somehow suspicious to me.
Following your explanation, I would have to test it myself before logging issues just like that. I will dedicate some time to see if it would work correctly. Even if, I do not think we need the 19 in the first 2 chars anyway.
Thank you!
The regex is matching iso date only format yyyy-mm-dd which it appears to properly do. Any years starting with 19 or 20 would work correctly. If we are expecting allow the year 2100, then you're correct this would fail.
I think the iso standard allows any 4 digits but atleast personally I find it more helpful for a system to guide me as the user with this kind of restriction to prevent values well out of the range of what is typically expected. To align more closely with iso, replacing /^(19|20)/d/d. With /^(1|2)/d/d/d would allow a much wider range of years but i cant find what the max limit of a sharepoint date is.
Thanks for the detailed explanation David @DaveCalGH! This is fully my bad, I should have tested that before logging an issue. Apologize for that and it seems like I wasted some of your time, but I learned something. I will be more careful next time.
Lets close this.
Most helpful comment
Thanks for the detailed explanation David @DaveCalGH! This is fully my bad, I should have tested that before logging an issue. Apologize for that and it seems like I wasted some of your time, but I learned something. I will be more careful next time.
Lets close this.