Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📦 NEW: 'last updated' field to bottom of response #20

Merged
merged 1 commit into from Mar 24, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

add 'last updated' field to bottom of response

  • Loading branch information
floturcocantsee committed Mar 23, 2020
commit bc5f3202eafbaa1a6091b3ec4ca6fbf28cd7a5fc
@@ -67,6 +67,9 @@ assets/bower_components/*
library/vendors/composer
assets/img/.DS_Store

# Visual Studio Project Files #
.vs/

# No lock files.
package-lock.json
yarn.lock
@@ -19,6 +19,7 @@ const handleError = require("cli-handle-error");
const getCountry = require("./utils/getCountry.js");
const getStates = require("./utils/getStates.js");
const getWorldwide = require("./utils/getWorldwide.js");
const getUpdated = require("./utils/getupdated.js");
const {
single,
colored,
@@ -51,5 +52,6 @@ const sortBy = cli.flags.sort;
await getStates(spinner, table, states, { sort: sortBy });
await getAll(spinner, table, states, country, { sort: sortBy });

getUpdated();
theEnd(states);
})();
@@ -0,0 +1,14 @@
// Get last updated time from corona.lmao.ninja
const axios = require("axios");
const chalk = require("chalk");
const logSymbols = require("log-symbols");
const cyan = chalk.cyan;

module.exports = async () => {
const api = await axios.get(`https://corona.lmao.ninja/all`);
let data = Object.values(api.data);

console.log(
`${logSymbols.info} ${cyan(`Last Updated:`)} ${Date(data[3])}`

This comment has been minimized.

Copy link
@ahmadawais

ahmadawais Mar 23, 2020

Owner

Shouldn't this be new Date()

This comment has been minimized.

Copy link
@floturcocantsee

floturcocantsee Mar 23, 2020

Author Contributor

It shouldn't matter since I'm not storing or manipulating it. The API just returns an integer containing the UNIX timestamp of the last updated time, so I just use the Date() function to make it human readable.

);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.