TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published


npm (scoped) npm GitHub

This is a collection of standalone Web Components to easily format dates.

@adc/date is part of the aide-de-camp Web Components collection.

How to install

You can either:

  • install the npm package with npm install @adc/date
  • rely on unpkg.com and a good ol' <script> tag

How to use


<!DOCTYPE html>
<html lang="en">
    <script src="https://unpkg.com/@adc/date/latest/dist/adc-date.js"></script>
    <!-- or use the path to your node_modules folder if you are using npm -->
    <!-- The @adc/date Web Components are now ready to be used. -->
    <!-- Please refer to the Component Catalog section below -->

Alternatively, if you want to take advantage of ES Modules, you could include the components using an import statement.

<!DOCTYPE html>
<html lang="en">
    <script type="module">
      import { defineCustomElements } from 'https://unpkg.com/@adc/date/latest/dist/esm/es2017/adc-date.define.js';
      // or use the path to your node_modules folder if you are using npm
    <!-- The @adc/date Web Components are now ready to be used. -->
    <!-- Please refer to the Component Catalog section below -->


Including the Custom Elements Schema

Including theCUSTOM_ELEMENTS_SCHEMA in the module allows the use of the web components in the HTML markup without the compiler producing errors. Here is an example of adding it to AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { SharedModule } from './shared/shared.module';

  declarations: [AppComponent],
  imports: [BrowserModule, FormsModule, SharedModule],
  bootstrap: [AppComponent],
export class AppModule {}

The CUSTOM_ELEMENTS_SCHEMA needs to be included in any module that uses custom elements.

Calling defineCustomElements

A component collection built with Stencil (such as this one) includes a main function that is used to load the components in the collection. That function is called defineCustomElements() and it needs to be called once during the bootstrapping of your application. One convenient place to do this is in main.ts as such:

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import { defineCustomElements } from '@adc/date/dist/loader';

if (environment.production) {

  .catch(err => console.log(err));


With an application built using the create-react-app starter the easiest way to include the component library is to call defineCustomElements(window) from the index.js file.

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

import { defineCustomElements } from '@adc/date/dist/loader';

ReactDOM.render(<App />, document.getElementById('root'));


In order to use the custom element library within the Vue app, the application must be modified to define the custom elements and to inform the Vue compiler which elements to ignore during compilation. This can all be done within the main.js file. For example (assuming you created your project with vue-cli):

import Vue from 'vue';
import App from './App.vue';
import { defineCustomElements } from '@adc/date/dist/loader';

Vue.config.productionTip = false;
Vue.config.ignoredElements = [/adc-date-\w*/];


new Vue({
  render: h => h(App),

Component Catalog

Browser support

  • Chrome (and all Chromium based browsers)
  • Safari
  • Edge
  • Firefox
  • IE 11

Web Components, specifically Custom Elements, are natively supported in Chrome and Safari and are coming to both Edge and Firefox. A dynamic polyfill loader is already included in order to only load the polyfills for the browsers that are missing specific features.

Package Sidebar


npm i @adc/date

Weekly Downloads






Unpacked Size

8.78 kB

Total Files


Last publish


  • davguij