@hastehaul/common 1.0.24 → 1.0.25

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": "1.0.25",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",