@timothyw/pat-common 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,3 @@
1
1
  import { DateString } from "../types";
2
2
  export declare const toDateString: (date: Date) => DateString;
3
+ export declare const fromDateString: (dateString: DateString) => Date;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDateString = void 0;
3
+ exports.fromDateString = exports.toDateString = void 0;
4
4
  const toDateString = (date) => {
5
5
  return date.toISOString();
6
6
  };
7
7
  exports.toDateString = toDateString;
8
+ const fromDateString = (dateString) => {
9
+ return new Date(dateString);
10
+ };
11
+ exports.fromDateString = fromDateString;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@timothyw/pat-common",
3
3
  "description": "",
4
4
  "author": "Timothy Washburn",
5
- "version": "1.0.45",
5
+ "version": "1.0.46",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -2,4 +2,8 @@ import { DateString } from "../types";
2
2
 
3
3
  export const toDateString = (date: Date): DateString => {
4
4
  return date.toISOString() as DateString;
5
+ }
6
+
7
+ export const fromDateString = (dateString: DateString): Date => {
8
+ return new Date(dateString);
5
9
  }