npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@devlaps/spacetime-adapter

v0.1.1

Published

Angular Material DateAdapter using the Spacetime library for timezone support.

Downloads

6

Readme

Spacetime Adapter for Angular Material

npm version

This library provides a DateAdapter implementation for Angular Material that uses the Spacetime library. This allows you to use Spacetime objects seamlessly with Angular Material components like the Datepicker, while also leveraging Spacetime's powerful timezone handling capabilities.

Features

  • Integrates spacetime with Angular Material's DateAdapter.
  • Provides correct date and time handling respecting timezones.
  • Uses Spacetime's parsing and formatting.
  • Configurable default timezone via a Signal<string> Injection Token.
  • Reacts dynamically to timezone changes if the provided signal is updated.
  • Standalone API using provider functions.

Dependencies

This library relies on the following peer dependencies:

  • @angular/core (^18.0.0 || ^19.0.0)
  • @angular/common (^18.0.0 || ^19.0.0)
  • @angular/material (^18.0.0 || ^19.0.0)
  • @angular/cdk (^18.0.0 || ^19.0.0)
  • spacetime (^7.9.0)

You need to have these installed in your project.

# Using npm
npm install @angular/core @angular/common @angular/material @angular/cdk spacetime

# Using pnpm
pnpm add @angular/core @angular/common @angular/material @angular/cdk spacetime

Installation

# Using npm
npm install @devlaps/spacetime-adapter

# Using pnpm
pnpm add @devlaps/spacetime-adapter

Usage

This library is designed for standalone Angular applications.

  1. Provide the Adapter and Timezone Signal:

    In your application's bootstrap function (e.g., main.ts or app.config.ts), use the provideSpacetimeAdapter function. You can provide a static timezone string (which will be wrapped in a signal internally) or provide your own Signal<string> for dynamic updates.

    // src/app/app.config.ts
    import { ApplicationConfig, signal, WritableSignal } from '@angular/core';
    import { provideRouter } from '@angular/router';
    import { provideAnimations } from '@angular/platform-browser/animations';
    import { provideSpacetimeAdapter } from '@devlaps/spacetime-adapter'; // Use the package name
    import { routes } from './app.routes';
    
    // Example: Create your own writable signal for dynamic updates
    export const appTimezoneSignal: WritableSignal<string> = signal('America/New_York');
    
    export const appConfig: ApplicationConfig = {
      providers: [
        provideRouter(routes),
        provideAnimations(),
    
        // Provide the Spacetime adapter
        // Option 1: Pass your dynamic signal
        provideSpacetimeAdapter(appTimezoneSignal)
    
        // Option 2: Pass a static string (adapter creates an internal signal)
        // provideSpacetimeAdapter('UTC')
    
        // Option 3: Omit parameter to default to an internal signal with 'UTC'
        // provideSpacetimeAdapter()
      ]
    };
  2. Provide Date Formats (Optional but Recommended):

    You should also provide the MAT_DATE_FORMATS token using the exported SPACETIME_DATE_FORMATS object.

    // src/app/app.config.ts
    import { ApplicationConfig, signal, WritableSignal } from '@angular/core';
    import { provideRouter } from '@angular/router';
    import { provideAnimations } from '@angular/platform-browser/animations';
    import { MAT_DATE_FORMATS } from '@angular/material/core';
    import {
      provideSpacetimeAdapter,
      SPACETIME_DATE_FORMATS
    } from '@devlaps/spacetime-adapter'; // Use the package name
    import { routes } from './app.routes';
    
    export const appTimezoneSignal: WritableSignal<string> = signal('America/New_York');
    
    export const appConfig: ApplicationConfig = {
      providers: [
        provideRouter(routes),
        provideAnimations(),
        provideSpacetimeAdapter(appTimezoneSignal), // Provide the adapter
    
        // Provide the recommended date formats
        { provide: MAT_DATE_FORMATS, useValue: SPACETIME_DATE_FORMATS }
      ]
    };

Now Angular Material components like mat-datepicker will use Spacetime for their date operations and react to changes in appTimezoneSignal (if you provided it).

API

  • SpacetimeAdapter: The core DateAdapter implementation.
  • provideSpacetimeAdapter(timeZoneInput?: string | Signal<string>): Standalone provider function. Accepts an optional timezone string or signal. If omitted, defaults to a signal containing 'UTC'. If a string is provided, it's wrapped in a signal internally.
  • SPACETIME_TIMEZONE: InjectionToken<Signal<string>> used internally to provide the timezone signal. The adapter reads the current value from this signal.
  • SPACETIME_DATE_FORMATS: An object compatible with MatDateFormats for use with MAT_DATE_FORMATS.

Building the Library

If you are working within this library's repository, you can build it using the Angular CLI:

ng build @devlaps/spacetime-adapter
# or use the project name:
ng build spacetime-adapter

The build artifacts will be located in the dist/spacetime-adapter directory.

License

MIT License. See the LICENSE file for details.