Skip to content

feat: Add zoneless support, Signals and fix multiple issues (#213, #230, #231)#235

Open
Nesho-Developer wants to merge 7 commits intodanielmoncada:masterfrom
Nesho-Developer:ahmed-ali/zoneless-support-and-fixes
Open

feat: Add zoneless support, Signals and fix multiple issues (#213, #230, #231)#235
Nesho-Developer wants to merge 7 commits intodanielmoncada:masterfrom
Nesho-Developer:ahmed-ali/zoneless-support-and-fixes

Conversation

@Nesho-Developer
Copy link

🚀 Add Zoneless Support & Fix Multiple Issues

Summary

This PR adds full zoneless mode support to the Angular DateTime Picker library, making it compatible with Angular's modern zoneless architecture. Additionally, it fixes several reported issues and improves the documentation for standalone app configuration.

✨ Major Features

1. Full Zoneless Support

  • ✅ Removed all NgZone dependencies from the library
  • ✅ Replaced NgZone.runOutsideAngular() with modern afterNextRender() API
  • ✅ Works seamlessly in both zoned and zoneless Angular applications
  • ✅ No breaking changes - backward compatible with zone.js apps

Benefits:

  • 📦 Smaller bundle size (~15KB saved when zone.js is removed)
  • ⚡ Better performance without zone.js overhead
  • 🎯 Predictable change detection
  • 🚀 Aligns with Angular's future direction

Files Changed:

  • calendar-body.component.ts - Updated focusActiveCell()
  • calendar.component.ts - Updated focusActiveCell()
  • timer.component.ts - Updated focus()
  • date-time-picker.component.ts - Updated popup positioning

2. Standalone App Documentation

  • ✅ Added comprehensive standalone app setup examples
  • ✅ Documented provideAnimations() usage
  • ✅ Added zoneless mode configuration guide
  • ✅ Marked NgModule approach as legacy

🐛 Bug Fixes

Fixed Issue #231 - Mobile UX Improvement

  • Added inputmode="numeric" to time picker inputs
  • Mobile devices now show numeric keyboard for hour/minute/second input
  • Improves user experience on touch devices

Fixed Issue #230 - BrowserAnimationsModule Deprecation

  • Updated README with standalone app configuration
  • Added examples using provideAnimations()
  • Clarified that BrowserAnimationsModule is deprecated in favor of provider functions
  • Works with provideNoopAnimations() for users who don't want animations

Fixed Issue #213 - Seconds Display

  • Modified formatString getter to include seconds when showSecondsTimer is enabled
  • Dynamically adds second: 'numeric' to format for both 'timer' and 'both' picker types
  • Input fields now correctly display HH:MM:SS when seconds timer is enabled

Investigated Issue #229 - Null End Date in Range Mode

  • Thoroughly reviewed range selection logic
  • Added test case with epoch date detection
  • Could not reproduce - code appears to handle null values correctly
  • Test case remains for verification

📚 Documentation Improvements

README Updates

  • Added "Zoneless Support" section with setup examples
  • Updated "How to Use" with standalone-first approach
  • Added "Animation" section for both standalone and NgModule
  • Marked legacy NgModule patterns appropriately

New Demo: Auto-Select Behavior

  • Created comprehensive demo showing when picker auto-closes
  • Explains pickerType="calendar" + pickerMode="popup" auto-close behavior
  • Compares all picker modes and types
  • Includes summary table for quick reference

🧪 Demo App Changes

  • Enabled zoneless mode in demo app
  • Removed zone.js dependency from package.json
  • Removed polyfills.ts file
  • Updated angular.json configuration
  • Demo now runs in zoneless mode to showcase compatibility

📊 Commits Breakdown

  1. refactor: convert to standalone with signals based - Foundation work
  2. fix: add inputmode="numeric" to time picker inputs - Issue Time popup should use numeric keyboard #231
  3. docs: update README with standalone app configuration - Issue Datepicker not working with if removing deprecated BrowserAnimationsModule #230
  4. fix: display seconds in input when showSecondsTimer is enabled - Issue Time Picker : -Not able to display seconds in input after selecting time from time picker #213
  5. feat: add full zoneless support by removing NgZone dependency - Main feature
  6. chore: enable zoneless mode in demo app - Demo updates
  7. feat: add auto-select demo - Documentation demo

✅ Testing

  • ✅ All builds pass successfully
  • ✅ Library compiles without errors
  • ✅ Demo app runs in zoneless mode
  • ✅ Backward compatible with zone.js applications
  • ✅ No breaking changes to public API

📦 Migration Guide

For Users Already Using the Library

No changes required! The library works with both zoned and zoneless apps.

For Users Wanting Zoneless Mode

In your main.ts:

import { bootstrapApplication } from '@angular/platform-browser';
import { provideExperimentalZonelessChangeDetection } from '@angular/core';
import { provideAnimations } from '@angular/platform-browser/animations';
import {
  provideOwlDateTime,
  provideOwlNativeDateTime
} from '@danielmoncada/angular-datetime-picker';

bootstrapApplication(AppComponent, {
  providers: [
    provideExperimentalZonelessChangeDetection(), // Enable zoneless
    provideAnimations(),
    provideOwlDateTime(),
    provideOwlNativeDateTime(),
  ]
});

🔗 Related Issues

🤝 Contribution

This PR maintains full backward compatibility while adding modern Angular features. All changes follow Angular best practices and use official Angular APIs.

Fixes danielmoncada#231

- Added inputmode="numeric" attribute to timer-box input field
- This displays the numeric keyboard on mobile devices for hour/minute/second inputs
- Improves mobile user experience by showing only number keys instead of full keyboard
)

- Add provideAnimations() setup for standalone apps
- Update "How to Use" section with standalone examples
- Mark NgModule approach as legacy
- Clarify animation configuration requirements
- Add test case for issue danielmoncada#229 (null end date in range)

Fixes danielmoncada#230: Users can now use the picker with provideAnimations()
instead of the deprecated BrowserAnimationsModule
…lmoncada#213)

- Modify formatString getter to include 'second: numeric' when showSecondsTimer is true
- Applies to both 'timer' and 'both' picker types
- Format is now dynamically created based on showSecondsTimer state

Previously, even when showSecondsTimer was enabled and users could
select seconds in the picker, the input field would only display HH:MM
without seconds. Now it correctly displays HH:MM:SS when the seconds
timer is enabled.

Fixes danielmoncada#213
- Replace NgZone.runOutsideAngular() with afterNextRender() in all components
- Remove NgZone imports and inject Injector instead
- Update calendar-body.component.ts focusActiveCell()
- Update calendar.component.ts focusActiveCell()
- Update timer.component.ts focus()
- Update date-time-picker.component.ts popup positioning
- Add comprehensive zoneless documentation to README

Benefits:
- Works seamlessly in both zoned and zoneless Angular apps
- Better performance without zone.js overhead
- Smaller bundle size (~15KB saved)
- Uses modern Angular APIs (afterNextRender)
- Aligns with Angular's future direction

The library now supports provideExperimentalZonelessChangeDetection()
without any code changes required from users.
- Remove zone.js dependency from package.json
- Add provideZonelessChangeDetection() to main.ts
- Remove polyfills.ts file (no longer needed)
- Update angular.json to remove polyfills references
- Update tsconfig files to remove polyfills.ts
- Add JsonPipe import to range-selection component for test case

The demo app now runs in zoneless mode to demonstrate
the library's full zoneless compatibility.
- Created comprehensive auto-select demo component
- Demonstrates auto-close in popup mode with calendar-only picker
- Shows comparison with time pickers (require OK)
- Includes range selection auto-close after both dates selected
- Compares dialog mode (always requires OK)
- Shows inline mode (always auto-selects)
- Added detailed summary table explaining when auto-select works

This demo clarifies that pickerType="calendar" + pickerMode="popup"
automatically closes after date selection without requiring OK button,
just like inline mode behavior.
@danielmoncada
Copy link
Owner

danielmoncada commented Nov 20, 2025

@Nesho-Developer appreciate the PR, but most (if not all) of this looks like AI generated with Claude. It can add a lot of unnecessary bloat as well. There are also various merge conflicts due to the amounts of refactoring, etc.

Can you create one PR for only the fixes / with appropriate README updates?

PR is just too massive to merge.

What kind regression was done on this?

@Nesho-Developer
Copy link
Author

@danielmoncada sure i used the ai to achieve what i want in short time, i pushed this pr to upgrade the lib because i used it many time and i always clone it and update it with my fix and used it as a lib in my mono-repo but this time i made this pr to help the community of this lib, so if you are going to accept it, i can fix the conflict if not acceptable just ignore it and thank you for your reply.


bootstrapApplication(AppComponent, {
providers: [
provideExperimentalZonelessChangeDetection(), // Enable zoneless mode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zoneless is stable since angular v20.0.0 provideZonelessChangeDetection()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants