Options
All
  • Public
  • Public/Protected
  • All
Menu

Handles everything related to the CurrentYear API.

access

public

example

const service = new CurrentYearService();

link

https://current-year-api.addy.codes/

property

{number=300} waitBetweenRequests Time in ms to wait between calls to the API

Hierarchy

  • CurrentYearService

Index

Constructors

constructor

Properties

waitBetweenRequests

waitBetweenRequests: number

Methods

getCurrentYear

  • getCurrentYear(timezone?: string): Promise<string>
  • async
    example

    await service.getCurrentYear("America/New_York")

    throws

    TimezoneError if invalid timezone

    Parameters

    • Optional timezone: string

      Desired timezone, following the TZ format

    Returns Promise<string>

    Current year on specified timezone as a string. If no timezone is required it assumes UTC.

getCurrentYearOnManyTimezones

  • getCurrentYearOnManyTimezones(timezones: string[]): Promise<[string, string][]>
  • async
    example

    await service.getCurrentYearOnManyTimezones(["America/New_York", "Europe/Madrid"])

    Parameters

    • timezones: string[]

      Desired timezones, following the TZ format

    Returns Promise<[string, string][]>

    Current year on specified timezones as a a tuple list.

Generated using TypeDoc