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

1.0.6 • Public • Published

airac-cc (AIRAC cycle calculator)

Build Status Coverage Status Issues NPM Version NPM License

This module can be used to calculate Aeronautical Information Regulation And Control (AIRAC) cycle identifiers and effectivity dates as defined by the International Civil Aviation Organization (ICAO). A list of current AIRAC cycle effectivity dates can be found here.

The code of this module is based on a similar Java library written by Johannes Kohnen.

Usage

const airac = require("airac-cc");
let cycle;
try {
    cycle = airac.Cycle.fromIdentifier("1909");
    console.log(cycle.effectiveStart);
    console.log(cycle.effectiveEnd);
} catch (error) {
    if (error instanceof airac.InvalidCycleIdentifierError) {
        // ...
    }
}
cycle = airac.Cycle.fromDate(new Date());
console.log(cycle.identifier);
console.log(cycle.effectiveStart);
console.log(cycle.effectiveEnd);

Note: when using the fromIdentifier method, this module will only consider AIRAC cycle identifiers between January 1st 1980 and December 31st 2079. Therefore, cycle 7501 will be considred to be the first cycle of 2075, not 1975! If you want to calculate effectifity dates outside of this range, use the fromDate method.

This module comes with TypeScript definitions. The TypeScript version of the code above:

import { Cycle, InvalidCycleIdentifierError } from "airac-cc";
let cycle;
try {
    cycle = Cycle.fromIdentifier("1909");
    console.log(cycle.effectiveStart);
    console.log(cycle.effectiveEnd);
} catch (error) {
    if (error instanceof InvalidCycleIdentifierError) {
        // ...
    }
}
cycle = Cycle.fromDate(new Date());
console.log(cycle.identifier);
console.log(cycle.effectiveStart);
console.log(cycle.effectiveEnd);

CLI

The AIRAC cycle calculator also comes with a CLI. Install it globally via

npm install -g airac-cc

This will install the command airac-cc globally on your system.

Print out the AIRAC cycle identifier and the corresponding effectivity dates of the currently effective AIRAC cycle to the console:

airac-cc

Print out the AIRAC cycle identifier and the corresponding effectivity dates for a specific AIRAC cycle (identified by the given cycle identifier):

airac-cc -i 1909

Note: when using the -i option, this module will only consider AIRAC cycle identifiers between January 1st 1980 and December 31st 2079. Therefore, cycle 7501 will be considred to be the first cycle of 2075, not 1975! If you want to calculate effectifity dates outside of this range, use the -d option (see below).

Print out the AIRAC cycle identifier and the corresponding effectivity dates for the cycle that's effective on a specific date (specify the date in ISO format):

airac-cc -d 2019-08-15

Print the help for the module:

airac-cc -h

Package Sidebar

Install

npm i airac-cc

Weekly Downloads

60

Version

1.0.6

License

ISC

Unpacked Size

12 kB

Total Files

12

Last publish

Collaborators

  • fundter