rakhadjo / timestamp-api

FreeCodeCamp API & Microservices Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test Cases:

  1. A request to /api/:date? with a valid date should return a JSON object with a unix key that is a Unix timestamp of the input date in milliseconds
  2. A request to /api/:date? with a valid date should return a JSON object with a utc key that is a string of the input date in the format: Thu, 01 Jan 1970 00:00:00 GMT
  3. A request to /api/1451001600000 should return
{ 
    unix: 1451001600000, 
    utc: "Fri, 25 Dec 2015 00:00:00 GMT" 
}
  1. Your project can handle dates that can be successfully parsed by new Date(date_string)
  2. If the input date string is invalid, the api returns an object having the structure:
{
    error : "Invalid Date" 
}
  1. An empty date parameter should return the current time in a JSON object with a unix key
  2. An empty date parameter should return the current time in a JSON object with a utc key

About

FreeCodeCamp API & Microservices Project

License:MIT License


Languages

Language:JavaScript 52.2%Language:HTML 32.0%Language:CSS 15.9%