czapp-shared 1.0.10 → 1.0.11

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.
package/dist/index.d.mts CHANGED
@@ -278,6 +278,7 @@ interface AutologinRequestBody {
278
278
  interface InsertOrUpdateRequestBody {
279
279
  czLexeme: ILexeme;
280
280
  enLexeme: ILexeme;
281
+ clientDate: MySQLDate;
281
282
  pairingNotes: string;
282
283
  }
283
284
  interface SignInRequestBody {
package/dist/index.d.ts CHANGED
@@ -278,6 +278,7 @@ interface AutologinRequestBody {
278
278
  interface InsertOrUpdateRequestBody {
279
279
  czLexeme: ILexeme;
280
280
  enLexeme: ILexeme;
281
+ clientDate: MySQLDate;
281
282
  pairingNotes: string;
282
283
  }
283
284
  interface SignInRequestBody {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czapp-shared",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "This is a shared library for Czapp projects. It contains common code that is used across multiple projects.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -7,7 +7,6 @@ import { MySQLDate } from '../index';
7
7
  * @type Date
8
8
  * @returns MySQLDate in the format "2021-01-01 07:41:23" or undefined if the input date is invalid
9
9
  */
10
-
11
10
  export const getMysqlDateIgnoreTZ = (date: Date): MySQLDate | undefined => {
12
11
  let dateStr: string;
13
12
  try {
@@ -22,20 +21,6 @@ export const getMysqlDateIgnoreTZ = (date: Date): MySQLDate | undefined => {
22
21
  }
23
22
  }
24
23
 
25
- /**
26
- * @name getMysqlDateAllowingForTZ
27
- * @param date
28
- */
29
- export const getMysqlDateAllowingForTZ = (date: Date): MySQLDate => {
30
- const zeroPad = (num: number): string => {
31
- return num < 10 ? `0${num}` : num.toString();
32
- }
33
- return `${date.getFullYear()}-${zeroPad(date.getMonth() + 1)}-${zeroPad(date.getDate())} ${zeroPad(date.getHours())}:${zeroPad(date.getMinutes())}:${zeroPad(date.getSeconds())}` as MySQLDate;
34
- }
35
-
36
-
37
-
38
-
39
24
  /**
40
25
  * @name convertJSDateStringToMySQLDate
41
26
  * @description Converts a JavaScript Date object to a MySQL date string
package/src/design/api.ts CHANGED
@@ -73,6 +73,7 @@ export interface AutologinRequestBody {
73
73
  export interface InsertOrUpdateRequestBody {
74
74
  czLexeme: ILexeme;
75
75
  enLexeme: ILexeme;
76
+ clientDate: MySQLDate;
76
77
  pairingNotes: string;
77
78
  }
78
79
  export interface SignInRequestBody {
package/test/date.test.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { expect } from 'chai';
2
2
  import {
3
3
  getMysqlDateIgnoreTZ,
4
- convertJSDateStringToMySQLDate, dateDifferenceInDays, getMysqlDateAllowingForTZ, isClientDateTooFarFromServerDate,
4
+ convertJSDateStringToMySQLDate,
5
+ dateDifferenceInDays,
6
+ isClientDateTooFarFromServerDate,
5
7
  isThePreviousDay,
6
- isTheSameDay, isValidJsDateString, isValidMysqlDateString,
8
+ isTheSameDay,
9
+ isValidJsDateString,
10
+ isValidMysqlDateString,
7
11
  MySQLDate
8
12
  } from '../src';
9
13
  describe('Date', () => {
@@ -59,17 +63,6 @@ describe('Date', () => {
59
63
  });
60
64
  });
61
65
 
62
- describe('getMysqlDateAllowingForTZ', () => {
63
- it('should convert a JavaScript date object to a MySQL date string', () => {
64
- const date = new Date("2021-01-01T07:41:23.000Z");
65
- expect(getMysqlDateAllowingForTZ(date)).to.equal("2021-01-01 07:41:23");
66
- });
67
- it('should return undefined if the input date is invalid', () => {
68
- const date = new Date("not a date");
69
- expect(getMysqlDateAllowingForTZ(date)).to.be.undefined;
70
- });
71
- });
72
-
73
66
  describe('convertJSDateStringToMySQLDateString', ()=> {
74
67
  it('should convert a JavaScript date string to a MySQL date string', () => {
75
68
  const date = "2021-01-01T07:41:23.000Z";