@jovo-community/plugin-timezone
    TypeScript icon, indicating that this package has built-in type declarations

    4.0.1 • Public • Published

    Time Zone Jovo Plugin

    Overview

    This plugin for the Jovo Framework v4 allows you to easily add cross-platform time zone support including an overall default time zone if there is not a country-code-specific default.

    For the plugin that support Jovo v3, use jovo-community-plugin-timezone

    Platforms

    The following platforms are supported:

    • Amazon Alexa
    • Google Assistant
    • Core/Web

    In the case of Amazon Alexa, after the first API call, the time zone is cached in Session Data at:

    this.jovo.$session.data.$timeZone

    Don't access or change this value, instead use the method on the plugin:

    const tz = await this.$timeZone.getTimeZone();

    Install

    Install the plugin into your Jovo project:

    npm install @jovo-community/plugin-timezone

    Register the plugin in app.ts:

    import { TimeZonePlugin } from '@jovo-community/plugin-timezone';
    
    const app = new App({
      // ...
    
      plugins: [
        new TimeZonePlugin(),
    
        // ...
      ],
    }

    Get the time zone in your handler:

    const tz = await this.$timeZone.getTimeZone();

    Configuration

    You can set an overall default time zone fallback or defaults based on the country code portion of the locale that is sent with every request.

    import { TimeZonePlugin } from '@jovo-community/plugin-timezone';
    
    const app = new App({
      // ...
    
      plugins: [
        new TimeZonePlugin({
          defaultTimeZone: 'America/New_York',
          defaultTimeZoneByLocaleCountryCode: {
            US: 'America/New_York',
            GB: 'Europe/London',
            CA: 'America/Toronto',
            AU: 'Australia/Sydney',
            IN: 'Asia/Kolkata',
          },
        }),
    
        // ...
      ],
    }

    Jovo Debugger

    If using the Jovo Debugger, you must add $timeZone to the list of properties the debugger ignores:

    // app.dev.ts
    
    new JovoDebugger({
      ignoredProperties: ['$app', '$handleRequest', '$platform', '$timeZone'],
    }),

    License

    MIT

    Keywords

    none

    Install

    npm i @jovo-community/plugin-timezone

    DownloadsWeekly Downloads

    8

    Version

    4.0.1

    License

    MIT

    Unpacked Size

    28.9 kB

    Total Files

    24

    Last publish

    Collaborators

    • dominik-meissner
    • rmtuckerphx
    • omenocal