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
Using .ToString("o") is a proper way to retrieve an ISO string in PowerShell/C#. The docs are stating this is a valid ISO 8601 format.
This outputs the date in following format: 2021-12-16T18:28:48.6964197Z.
When I look at the code you can see that only 3 milliseconds digits are considered valid.
This is the reason why the command results in an error message. An ISO string with 7 milliseconds digits is considered as invalid. This shouldn't be the case, an ISO string with 7 milliseconds digits is valid. After changing the code, it works perfectly.
As you can see, the result output has 7 milliseconds digits as well for createdDateTime.
Apart from that, when you check the docs of this command, you can see that the options --startDateTime and --endDateTime show an example of a date with 7 milliseconds digits. So when you use the examples from the docs, you'll receive an error message saying the date is invalid.
Steps to reproduce
Use any command with a date validation e.g. planner task add and specify a date string with 7 milliseconds digits.
Description
When I'm using the
planner task add
command with--startDateTime
option in PowerShell, I always get following error:I'm using PowerShell, passing
startDateTime
like this:Using
.ToString("o")
is a proper way to retrieve an ISO string in PowerShell/C#. The docs are stating this is a valid ISO 8601 format.This outputs the date in following format:
2021-12-16T18:28:48.6964197Z
.When I look at the code you can see that only 3 milliseconds digits are considered valid.
cli-microsoft365/src/utils/validation.ts
Lines 56 to 61 in 694dbc5
This is the reason why the command results in an error message. An ISO string with 7 milliseconds digits is considered as invalid. This shouldn't be the case, an ISO string with 7 milliseconds digits is valid. After changing the code, it works perfectly.
As you can see, the result output has 7 milliseconds digits as well for
createdDateTime
.Apart from that, when you check the docs of this command, you can see that the options
--startDateTime
and--endDateTime
show an example of a date with 7 milliseconds digits. So when you use the examples from the docs, you'll receive an error message saying the date is invalid.Steps to reproduce
Use any command with a date validation e.g.
planner task add
and specify a date string with 7 milliseconds digits.Example:
Expected results
The command should accept the input and execute.
Actual results
Error: The startDateTime is not a valid ISO date string
Diagnostics
No response
CLI for Microsoft 365 version
v5.3.0
nodejs version
v16.11.1
Operating system (environment)
Windows
Shell
Windows PowerShell
cli doctor
No response
Additional Info
I suggest that we add an extra validation rule so both date strings with 3 and 7 milliseconds digits are valid.
The text was updated successfully, but these errors were encountered: