API to parse human date to ISO 8601 formatted date
This is a Node.js application that convert a date like 'tomorrow at 10:00' to ISO 8601 formatted date.
- Clone this repository:
git clone https://github.com/voiceflow-gallagan/vf-date-parser.git
cd vf-date-parser
- Copy the
.env.template
file and create a new.env
file:
cp .env.template .env
- Edit the
.env
file to reflect the PORT you want to use.
The application uses the following environment variables which are stored in a .env
file:
PORT
: The port on which the server will run. Default is 3000.
-
Install node / npm
-
Install dependencies:
npm install
- Run the app:
npm start
-
Install Docker / Docker Compose on your machine
-
In the project directory, you can start the container with:
docker-compose up --build -d
or
npm run docker-start
- To stop the container, you can use:
docker-compose down
or
npm run docker-stop
-
GET /health
: Returns the current status of the server. -
POST /date
: Convert the given date.Body payload example:
{ "date":"next friday at 6pm", "tz":1 }
The date value can be something like:
- tomorrow at 10pm
- next monday
- in to weeks at 9am
tz is the offset for the timezone. For example, if you are in France, you should set the tz to 1.
Response example:
{ "success": true, "debug": "next friday at 6pm", "error": null, "date": "2024-01-26T19:00:00.000Z" }
This project is licensed under the MIT License. See the LICENSE file for details.
We can talk about this project on Discord https://discord.gg/9JRv5buT39