A mirror from Github (https://github.com/dragfyre/bahai-date-api). Unchanged.

dragfyre cbbb3dd6ef Merge pull request #18 from dragfyre/dependabot/npm_and_yarn/ini-1.3.7 hace 5 años
api 2870180a2d - Fix: Ensure using utf-8 for HTML view hace 5 años
bin 77770bee30 - Linting: As per latest ash-nazg hace 5 años
images db872395b3 - Enhancement: Add CLI for displaying date in plain text only or JSON hace 6 años
.editorconfig 11c0fc84ba - Docs: Use syntax highlighting for JSON samples; use diacritics hace 6 años
.eslintignore 11c0fc84ba - Docs: Use syntax highlighting for JSON samples; use diacritics hace 6 años
.eslintrc.js 77770bee30 - Linting: As per latest ash-nazg hace 5 años
.gitignore c7dcab448c initial commit hace 8 años
LICENSE-ISC.txt 2b759c8f46 - Add LICENSE-ISC.txt file per `package.json` hace 6 años
README.md db872395b3 - Enhancement: Add CLI for displaying date in plain text only or JSON hace 6 años
package-lock.json 747c996dac build(deps): Bump ini from 1.3.5 to 1.3.7 hace 5 años
package.json 5db32b25c8 - npm: Update luxon (minor), express-rate-limit (minor), devDeps, package-lock hace 5 años
server.js 77770bee30 - Linting: As per latest ash-nazg hace 5 años

README.md

Baháʼí Date RESTful API

So far, there are two endpoints for this API:

POST /today

Returns today's date according to the Baháʼí/Badí' calendar via POST request.

GET /date

Given a date from the Gregorian calendar defined via GET data, returns the corresponding date in the Baháʼí calendar.

Running

To launch the API server, simply navigate to the main folder and type npm start.

Examples

From either endpoint, the output is returned in a similar format: a JSON object containing a message, a Baháʼí calendar date, and a Gregorian date/time.

Today

URL: localhost:1844/today

{
    "message": "Today is 13 Masá’il 174",
    "badi_date": {
        "year": 174,
        "month": 14,
        "day": 13,
        "month_name": "Masá’il"
    },
    "greg_date": {
        "year": 2017,
        "month": 12,
        "day": 5,
        "hour": 23,
        "minute": 19,
        "second": 12
    }
}

May 23, 1844

URL: localhost:1844/date?year=1844&month=5&day=23&hour=20&minute=45

Output:

{
    "message": "The date is: 9 ‘Aẓamat 1",
    "badi_date": {
        "year": 1,
        "month": 3,
        "day": 9,
        "month_name": "‘Aẓamat"
    },
    "greg_date": {
        "year": 1844,
        "month": 5,
        "day": 23,
        "hour": 20,
        "minute": 45,
        "second": 0
    }
}

February 15, 2014

URL: localhost:1844/date?year=2014&month=2&day=15&hour=13&minute=45

Output:

{
    "message": "The date is: 10 Mulk 170",
    "badi_date": {
        "year": 170,
        "month": 17,
        "day": 10,
        "month_name": "Mulk"
    },
    "greg_date": {
        "year": 2014,
        "month": 2,
        "day": 15,
        "hour": 13,
        "minute": 45,
        "second": 0
    }
}

CLI usage

cli.svg