sales-frontend-utils 0.0.39 → 0.0.40

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.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import dayjs from 'dayjs';
2
+
1
3
  /**
2
4
  * 쓰로틀
3
5
  * @param func
@@ -360,7 +362,7 @@ declare const getOneMonthLater: (value?: string, format?: string) => string;
360
362
  * @param date2 (yyyymmdd or yyyy.mm.dd or yyyy-mm-dd)
361
363
  * @returns date1 - date2
362
364
  */
363
- declare const getDateDiff: (date1: string, date2: string) => number;
365
+ declare const getDateDiff: (date1: string | number | dayjs.Dayjs | Date, date2: string | number | dayjs.Dayjs | Date) => number;
364
366
  /**
365
367
  * 입력되어진 생년월일 값이 당일 기준으로 미래시점인 경우 false를 반환합니다. (회원체계 기준 9, 0 일 경우 오류)
366
368
  * @param front 주민등록번호 앞 6자리
@@ -374,14 +376,14 @@ declare const validateBirthdate: (front: string, back: string) => boolean;
374
376
  * @param compareDate
375
377
  * @returns boolean
376
378
  */
377
- declare function isDateAfter(targetDate: string, compareDate: string): boolean;
379
+ declare function isDateAfter(targetDate: string | number | dayjs.Dayjs | Date, compareDate: string | number | dayjs.Dayjs | Date): boolean;
378
380
  /**
379
381
  * 날짜를 포맷형태로 리턴
380
382
  * @param 20200101 string
381
383
  * @param 'YYYY.MM.DD
382
384
  * @returns 포맷화된 날짜
383
385
  */
384
- declare const convertDateFormat: (value?: string, format?: string) => string;
386
+ declare const convertDateFormat: (value?: string | number | dayjs.Dayjs | Date, format?: string) => string;
385
387
  /**
386
388
  * 주어진 날짜가 오늘 날짜 이후인지 확인합니다.
387
389
  *
@@ -389,7 +391,7 @@ declare const convertDateFormat: (value?: string, format?: string) => string;
389
391
  * @param {dayjs.OptionType} [format] - 날짜 문자열의 형식입니다.
390
392
  * @returns {boolean} - 주어진 날짜가 오늘 이후라면 true를 반환합니다.
391
393
  */
392
- declare const isFutureDate: (dateString?: string, format?: string) => boolean;
394
+ declare const isFutureDate: (dateString?: string | number | dayjs.Dayjs | Date, format?: dayjs.OptionType) => boolean;
393
395
  /**
394
396
  * 날짜 유효성 검사
395
397
  *
@@ -397,7 +399,7 @@ declare const isFutureDate: (dateString?: string, format?: string) => boolean;
397
399
  * @param {dayjs.OptionType} [format] - 날짜 문자열의 형식입니다.
398
400
  * @returns {boolean} - 유효한 날짜이면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
399
401
  */
400
- declare const isValidDate: (dateString?: string, format?: string) => boolean;
402
+ declare const isValidDate: (dateString?: string | number | dayjs.Dayjs | Date, format?: dayjs.OptionType) => boolean;
401
403
  type PeriodType = 'thisWeek' | 'lastWeek' | 'last7Days' | 'thisMonth' | 'lastMonth' | 'last365Days';
402
404
  declare const getPeriodDate: (periodType: PeriodType) => {
403
405
  startDate: Date;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import dayjs from 'dayjs';
2
+
1
3
  /**
2
4
  * 쓰로틀
3
5
  * @param func
@@ -360,7 +362,7 @@ declare const getOneMonthLater: (value?: string, format?: string) => string;
360
362
  * @param date2 (yyyymmdd or yyyy.mm.dd or yyyy-mm-dd)
361
363
  * @returns date1 - date2
362
364
  */
363
- declare const getDateDiff: (date1: string, date2: string) => number;
365
+ declare const getDateDiff: (date1: string | number | dayjs.Dayjs | Date, date2: string | number | dayjs.Dayjs | Date) => number;
364
366
  /**
365
367
  * 입력되어진 생년월일 값이 당일 기준으로 미래시점인 경우 false를 반환합니다. (회원체계 기준 9, 0 일 경우 오류)
366
368
  * @param front 주민등록번호 앞 6자리
@@ -374,14 +376,14 @@ declare const validateBirthdate: (front: string, back: string) => boolean;
374
376
  * @param compareDate
375
377
  * @returns boolean
376
378
  */
377
- declare function isDateAfter(targetDate: string, compareDate: string): boolean;
379
+ declare function isDateAfter(targetDate: string | number | dayjs.Dayjs | Date, compareDate: string | number | dayjs.Dayjs | Date): boolean;
378
380
  /**
379
381
  * 날짜를 포맷형태로 리턴
380
382
  * @param 20200101 string
381
383
  * @param 'YYYY.MM.DD
382
384
  * @returns 포맷화된 날짜
383
385
  */
384
- declare const convertDateFormat: (value?: string, format?: string) => string;
386
+ declare const convertDateFormat: (value?: string | number | dayjs.Dayjs | Date, format?: string) => string;
385
387
  /**
386
388
  * 주어진 날짜가 오늘 날짜 이후인지 확인합니다.
387
389
  *
@@ -389,7 +391,7 @@ declare const convertDateFormat: (value?: string, format?: string) => string;
389
391
  * @param {dayjs.OptionType} [format] - 날짜 문자열의 형식입니다.
390
392
  * @returns {boolean} - 주어진 날짜가 오늘 이후라면 true를 반환합니다.
391
393
  */
392
- declare const isFutureDate: (dateString?: string, format?: string) => boolean;
394
+ declare const isFutureDate: (dateString?: string | number | dayjs.Dayjs | Date, format?: dayjs.OptionType) => boolean;
393
395
  /**
394
396
  * 날짜 유효성 검사
395
397
  *
@@ -397,7 +399,7 @@ declare const isFutureDate: (dateString?: string, format?: string) => boolean;
397
399
  * @param {dayjs.OptionType} [format] - 날짜 문자열의 형식입니다.
398
400
  * @returns {boolean} - 유효한 날짜이면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
399
401
  */
400
- declare const isValidDate: (dateString?: string, format?: string) => boolean;
402
+ declare const isValidDate: (dateString?: string | number | dayjs.Dayjs | Date, format?: dayjs.OptionType) => boolean;
401
403
  type PeriodType = 'thisWeek' | 'lastWeek' | 'last7Days' | 'thisMonth' | 'lastMonth' | 'last365Days';
402
404
  declare const getPeriodDate: (periodType: PeriodType) => {
403
405
  startDate: Date;
package/dist/index.js CHANGED
@@ -868,10 +868,8 @@ var getOneMonthLater = (value, format) => {
868
868
  }
869
869
  };
870
870
  var getDateDiff = (date1, date2) => {
871
- const yyyyMMdd1 = date1.replace(/[.|-]/g, "");
872
- const yyyyMMdd2 = date2.replace(/[.|-]/g, "");
873
- const diff1 = dayjs(dayjs(yyyyMMdd1).format("YYYY-MM-DD"));
874
- const diff2 = dayjs(yyyyMMdd2).format("YYYY-MM-DD");
871
+ const diff1 = dayjs(date1);
872
+ const diff2 = dayjs(date2);
875
873
  return diff1.diff(diff2, "day");
876
874
  };
877
875
  var validateBirthdate = (front, back) => {