Bug report: isValidISODateDashOnly accepts text before or after the date-time
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- backend-api-design, cli
Research direction
Start in src/utils/validation.ts at line 89, where isValidISODateDashOnly defines the date-time regex. Check for existing validation tests and add cases for the three malformed strings in the report, confirming they return false while valid ISO date-time formats still pass. Done when the regex anchors the full input and the regression cases pass.
Written by the indexing model from the issue text.
Description
Priority
(Low) Something is a little off
Description
validation.isValidISODateDashOnly accepts strings that only contain a date-time somewhere inside them. The date-time regex is ^(A)|(B)|(C)$, so ^ only applies to the first alternative and $ only to the last one. The middle one (YYYY-MM-DDTHH:mm:ssZ) has no anchors at all.
This function validates --since in teams message list and --fromDateTime / --toDateTime in teams report pstncalls and teams report directroutingcalls, so bad values pass validation and are sent to Graph.
Steps to reproduce
import { validation } from '@pnp/cli-microsoft365/dist/utils/validation.js';
validation.isValidISODateDashOnly('2026-11-01T10:00:00.123Zfoo'); // true
validation.isValidISODateDashOnly('next friday 2026-11-01T10:00:00Z'); // true
validation.isValidISODateDashOnly('x2026-11-01T10:00Z'); // true
Or m365 teams report pstncalls --fromDateTime "x2026-11-01T10:00:00Z": validation passes and the value goes into the Graph URL.
Expected results
false for all three, the same as for other non-ISO input such as sharing is caring.
Actual results
true for all three.
Diagnostics
No response
CLI for Microsoft 365 version
main (12.1.0)
nodejs version
v24.10.0
Operating system (environment)
macOS
Shell
zsh
cli doctor
No response
Additional Info
Cause: src/utils/validation.ts line 89. Fix is to wrap the three alternatives in one group, ^(?:A|B|C)$. I'm happy to open a PR with a test.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 413
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 19
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pnp/cli-microsoft365
-
Add noCrawl and enableMinimalDownload options to spo web setPossibly taken @TariQMah claimed this today. Openenhancement good first issue work in progress
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pnp/cli-microsoft365#7710 · 2 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pnp/cli-microsoft365#7695 · 5 comments ·
Maintainers usually reply within 1 day
-
Minimal permissions for 'util miscellaneous' commandsPossibly taken @Labu1 claimed this 2 days ago. Opendocs work in progress
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pnp/cli-microsoft365#7535 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Minimal permissions for 'teams user app' commandsPossibly taken @SmitaNachan claimed this 48 days ago. Opendocs work in progress
Difficulty 2/5 1-2 days Newbie friendliness 78/100
pnp/cli-microsoft365#7529 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
docs help wanted
Difficulty 2/5 1-2 days Newbie friendliness 78/100
pnp/cli-microsoft365#7507 ·
Maintainers usually reply within 1 day
All issues in pnp/cli-microsoft365
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
rel: fix
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/fews-web-oc#2400 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ardia-browser/ardia#4426 ·
Maintainers usually reply within 1 day
-
Diagram: Journey Type: Bug / Error
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mermaid-js/mermaid-v13#1293 ·
Maintainers usually reply within 1 day
-
beginner bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hiero-ledger/hiero-sdk-js#4824 ·
Maintainers usually reply within 1 day