@hastehaul/common 1.0.24 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,3 @@
1
1
  export declare function hasElapsed(expirationDate: Date): boolean;
2
2
  export declare function colorize(text: string, colorCode: number): string;
3
+ export declare function formatDatetimeToHumanReadable(datetime: Date, format?: string): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorize = exports.hasElapsed = void 0;
6
+ exports.formatDatetimeToHumanReadable = exports.colorize = exports.hasElapsed = void 0;
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  function hasElapsed(expirationDate) {
9
9
  const currentDate = (0, moment_1.default)();
@@ -16,3 +16,7 @@ function colorize(text, colorCode) {
16
16
  return `\x1b[${colorCode}m${text}\x1b[0m`;
17
17
  }
18
18
  exports.colorize = colorize;
19
+ function formatDatetimeToHumanReadable(datetime, format) {
20
+ return (0, moment_1.default)(datetime).format(format || 'MMMM D, YYYY h:mm A');
21
+ }
22
+ exports.formatDatetimeToHumanReadable = formatDatetimeToHumanReadable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "1.0.24",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -10,7 +10,9 @@
10
10
  "scripts": {
11
11
  "clean": "del \"build\"",
12
12
  "build": "npm run clean && tsc",
13
- "pub": "git add . && git commit -m \"Update\" && npm version patch && npm run build && npm publish"
13
+ "pub:patch": "git add . && git commit -m \"Update [Patch]\" && npm version patch && npm run build && npm publish",
14
+ "pub:major": "git add . && git commit -m \"Update [Major]\" && npm version major && npm run build && npm publish",
15
+ "pub:minor": "git add . && git commit -m \"Update [Minor]\" && npm version minor && npm run build && npm publish"
14
16
  },
15
17
  "keywords": [],
16
18
  "author": "",