inviton-powerduck 0.0.156 → 0.0.158

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.
@@ -265,9 +265,6 @@ export class AppHttpProvider {
265
265
  if (keyVal != null && keyVal.indexOf && TemporalUtils.isSerializedDate(keyVal)) {
266
266
  try {
267
267
  obj[key] = TemporalUtils.fromString(keyVal);
268
- if (isNaN(obj[key].getTime())) {
269
- obj[key] = keyVal;
270
- }
271
268
  } catch (e) {
272
269
  obj[key] = keyVal;
273
270
  }
@@ -1061,6 +1061,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1061
1061
  redrawDatePicker();
1062
1062
  checkAndSetDefaultValue();
1063
1063
  updateCalendarWidth();
1064
+
1064
1065
  if (opt.customOpenAnimation) {
1065
1066
  opt.customOpenAnimation.call(box.get(0), () => {
1066
1067
  $(self).trigger('datepicker-opened', {
@@ -1274,7 +1275,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1274
1275
  return r;
1275
1276
  }
1276
1277
 
1277
- function dayClicked(day) {
1278
+ function dayClicked(day: JQuery) {
1278
1279
  if (day.hasClass('invalid')) { return; }
1279
1280
 
1280
1281
  const time = Number(day.attr('time'));
@@ -1671,7 +1672,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1671
1672
  }
1672
1673
  }
1673
1674
 
1674
- function showSelectedInfo(forceValid?, silent?) {
1675
+ function showSelectedInfo(forceValid?: boolean, silent?: boolean) {
1675
1676
  box.find('.start-day').html('...');
1676
1677
  box.find('.end-day').html('...');
1677
1678
  box.find('.selected-days').hide();
@@ -1795,7 +1796,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1795
1796
  autoclose();
1796
1797
  }
1797
1798
 
1798
- function setSingleDate(date1) {
1799
+ function setSingleDate(date1: Temporal.PlainDateTime) {
1799
1800
  let valid = true;
1800
1801
  if (opt.startDate && compare_day(date1, opt.startDate) < 0) { valid = false; }
1801
1802
 
@@ -1806,8 +1807,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1806
1807
  return;
1807
1808
  }
1808
1809
 
1809
- opt.start = date1.getTime();
1810
-
1810
+ opt.start = date1;
1811
1811
  if (opt.time.enabled) {
1812
1812
  renderTime('time1', date1);
1813
1813
  }
@@ -1907,6 +1907,10 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1907
1907
  }
1908
1908
 
1909
1909
  function getDateString(d: Temporal.PlainDateTime) {
1910
+ if (d == null) {
1911
+ return '';
1912
+ }
1913
+
1910
1914
  return DateUtils.formatDate(d, opt.format);
1911
1915
  }
1912
1916
 
@@ -1952,22 +1956,18 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1952
1956
  showMonth(opt.month2, 'month2');
1953
1957
  }
1954
1958
 
1955
- function compare_month(m1: Temporal.PlainDateTime, m2: Temporal.PlainDateTime): number {
1956
- const p = parseInt(DateUtils.formatDate(m1, 'yyyyMM')) - parseInt(DateUtils.formatDate(m2, 'yyyyMM'));
1957
- if (p > 0) { return 1; }
1958
-
1959
- if (p === 0) { return 0; }
1960
-
1961
- return -1;
1959
+ function compare_month(a: Temporal.PlainDateTime, b: Temporal.PlainDateTime): number {
1960
+ if (a.year !== b.year) {
1961
+ return a.year < b.year ? -1 : 1;
1962
+ }
1963
+ if (a.month !== b.month) {
1964
+ return a.month < b.month ? -1 : 1;
1965
+ }
1966
+ return 0;
1962
1967
  }
1963
1968
 
1964
1969
  function compare_day(m1: Temporal.PlainDateTime, m2: Temporal.PlainDateTime): number {
1965
- const p = parseInt(DateUtils.formatDate(m1, 'yyyyMMdd')) - parseInt(DateUtils.formatDate(m2, 'yyyyMMdd'));
1966
- if (p > 0) { return 1; }
1967
-
1968
- if (p === 0) { return 0; }
1969
-
1970
- return -1;
1970
+ return Temporal.PlainDate.compare(m1.toPlainDate(), m2.toPlainDate());
1971
1971
  }
1972
1972
 
1973
1973
  function nextMonth(month: Temporal.PlainDateTime): Temporal.PlainDateTime {
@@ -2325,6 +2325,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
2325
2325
  valid,
2326
2326
  });
2327
2327
  }
2328
+
2328
2329
  const html = [];
2329
2330
  for (let week = 0; week < 6; week++) {
2330
2331
  if (days[week * 7].type == 'nextMonth') {
@@ -2336,7 +2337,7 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
2336
2337
  for (var day: any = 0; day < 7; day++) {
2337
2338
  const _day: any = (opt.startOfWeek == 'monday') ? day + 1 : day;
2338
2339
  const today = days[week * 7 + _day];
2339
- const highlightToday = DateUtils.formatDate(today.time, 'yyyyMMdd') == DateUtils.formatDate(now, 'yyyyMMdd');
2340
+ const highlightToday = (Temporal.PlainDateTime.compare(today.date.toPlainDate(), now.toPlainDate()) == 0);
2340
2341
  today.extraClass = '';
2341
2342
  today.tooltip = '';
2342
2343
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.156",
4
+ "version": "0.0.158",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",