-
-
Notifications
You must be signed in to change notification settings - Fork 115
fix(tables): update ColumnHighlighter + add DateTime example #514
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
fix(tables): update ColumnHighlighter + add DateTime example #514
Conversation
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.
Pull request overview
This pull request updates the DataTables ColumnHighlighter JavaScript library to version 0.1.10 and adds comprehensive date/time parsing and formatting support. The changes improve compatibility with PowerShell/.NET date formats, add Bootstrap 5.3 table striping support, enhance column name matching tolerance, and improve locale-aware number parsing.
Key Changes
- Enhanced date/time parsing with support for .NET/PowerShell format tokens (dd/MM/yyyy, etc.) and automatic conversion to Moment.js formats, with fallback parsing when Moment.js is unavailable
- Improved number parsing to handle both comma and dot decimal separators for international locale support
- Fixed Bootstrap 5.3 table striping compatibility by using box-shadow overlays instead of simple background colors
- Added tolerant column name matching that ignores case, spacing, and punctuation differences
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Resources/JS/dataTables.columnHighlighter.js | Complete rewrite with new date parsing functions (dotNetToMomentFormat, parseDateByFormatHint, parseDateValue), locale-aware number parsing (parseLocaleNumber), tolerant column matching (normalizeName), and Bootstrap 5.3 compatibility fixes for cell highlighting |
| Private/Parameters.Configuration.ps1 | Updated CDN link from version 0.1.2 to 0.1.10 and removed trailing whitespace |
| Examples/Example-Table/Example-TableDateTimeConditionsFormats.ps1 | New example demonstrating date comparisons with dd/MM/yyyy format in both HTML and JavaScript DataStore modes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| New-HTMLTableOption -DataStore JavaScript -DateTimeFormat 'dd/MM/yyyy HH:mm:ss' | ||
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | ||
| New-HTMLTableHeader -Title 'JavaScript: Highlight RefreshTokenDate < threshold' | ||
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'dd/MM/YYYY HH:mm:ss' |
Copilot
AI
Dec 14, 2025
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.
Same inconsistency in date format case conventions as lines 17-20. The New-HTMLTableOption uses lowercase tokens (dd/MM/yyyy) while New-HTMLTable and New-HTMLTableCondition use uppercase tokens (DD/MM/YYYY). Consider standardizing on one convention for clarity.
| if (nums.length > 6) { | ||
| // Use the first 3 digits of the next group as milliseconds (covers 3/6/7 digit fractions from .NET) | ||
| var msStr = '' + numsRaw[6]; | ||
| ms = parseInt(msStr.substring(0, 3), 10); |
Copilot
AI
Dec 14, 2025
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.
The millisecond parsing logic has a potential issue. When the fractional seconds in the date string have fewer than 3 digits, the substring operation will correctly get those digits, but the resulting number will not properly represent milliseconds. For example, if the fractional part is "5" (representing 500ms), parseInt("5".substring(0, 3), 10) returns 5 (not 500). To fix this, pad the string to 3 characters before parsing, or multiply by the appropriate power of 10 based on the actual length.
| ms = parseInt(msStr.substring(0, 3), 10); | |
| ms = parseInt(msStr.substring(0, 3).padEnd(3, '0'), 10); |
| New-HTMLSection -HeaderText 'HTML DataStore (dd/MM/yyyy)' { | ||
| New-HTMLTableOption -DataStore HTML -DateTimeFormat 'dd/MM/yyyy HH:mm:ss' | ||
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | ||
| New-HTMLTableHeader -Title 'HTML: Highlight RefreshTokenDate < threshold' | ||
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'dd/MM/YYYY HH:mm:ss' | ||
| } | ||
| } | ||
|
|
||
| New-HTMLSection -HeaderText 'JavaScript DataStore (dd/MM/yyyy)' { | ||
| New-HTMLTableOption -DataStore JavaScript -DateTimeFormat 'dd/MM/yyyy HH:mm:ss' | ||
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | ||
| New-HTMLTableHeader -Title 'JavaScript: Highlight RefreshTokenDate < threshold' | ||
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'dd/MM/YYYY HH:mm:ss' |
Copilot
AI
Dec 14, 2025
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.
There's an inconsistency in date format case conventions. The New-HTMLTableOption uses lowercase format tokens (dd/MM/yyyy) while New-HTMLTable's DateTimeSortingFormat and New-HTMLTableCondition's DateTimeFormat use uppercase tokens (DD/MM/YYYY). While the JavaScript code handles both through the dotNetToMomentFormat converter, this inconsistency can be confusing for users. Consider standardizing on one convention throughout the example, preferably using the Moment.js convention (uppercase DD/MM/YYYY) since that's what the sorting format requires.
| New-HTMLSection -HeaderText 'HTML DataStore (dd/MM/yyyy)' { | |
| New-HTMLTableOption -DataStore HTML -DateTimeFormat 'dd/MM/yyyy HH:mm:ss' | |
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | |
| New-HTMLTableHeader -Title 'HTML: Highlight RefreshTokenDate < threshold' | |
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'dd/MM/YYYY HH:mm:ss' | |
| } | |
| } | |
| New-HTMLSection -HeaderText 'JavaScript DataStore (dd/MM/yyyy)' { | |
| New-HTMLTableOption -DataStore JavaScript -DateTimeFormat 'dd/MM/yyyy HH:mm:ss' | |
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | |
| New-HTMLTableHeader -Title 'JavaScript: Highlight RefreshTokenDate < threshold' | |
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'dd/MM/YYYY HH:mm:ss' | |
| New-HTMLSection -HeaderText 'HTML DataStore (DD/MM/YYYY)' { | |
| New-HTMLTableOption -DataStore HTML -DateTimeFormat 'DD/MM/YYYY HH:mm:ss' | |
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | |
| New-HTMLTableHeader -Title 'HTML: Highlight RefreshTokenDate < threshold' | |
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'DD/MM/YYYY HH:mm:ss' | |
| } | |
| } | |
| New-HTMLSection -HeaderText 'JavaScript DataStore (DD/MM/YYYY)' { | |
| New-HTMLTableOption -DataStore JavaScript -DateTimeFormat 'DD/MM/YYYY HH:mm:ss' | |
| New-HTMLTable -DataTable $AdminsDisabled -HideFooter -DisablePaging -DateTimeSortingFormat 'DD/MM/YYYY HH:mm:ss' { | |
| New-HTMLTableHeader -Title 'JavaScript: Highlight RefreshTokenDate < threshold' | |
| New-HTMLTableCondition -Name 'RefreshTokenDate' -ComparisonType 'date' -Operator lt -Value $DateDeleteCheck -BackgroundColor Red -Color Black -FailBackgroundColor LightGreen -FailColor Black -DateTimeFormat 'DD/MM/YYYY HH:mm:ss' |
Pull Request Review - PR #514OverviewThis PR updates the DataTables ColumnHighlighter JavaScript library from v0.1.2 to v0.1.12, adds a new example demonstrating DateTime condition formatting, and bumps the module version to 1.40.0. Code Quality & Best Practices✅ Strengths
Potential Issues & Concerns
|
No description provided.