@skyux/datetime 5.1.2 → 5.1.3

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.
@@ -734,6 +734,63 @@
734
734
  }]
735
735
  }] });
736
736
 
737
+ /**
738
+ * Represents the calculator.
739
+ */
740
+ var SkyDateRangeCalculator = /** @class */ (function () {
741
+ function SkyDateRangeCalculator(
742
+ /**
743
+ * Provides a calculator ID to specify calculator objects that represent date ranges.
744
+ */
745
+ calculatorId, config) {
746
+ this.calculatorId = calculatorId;
747
+ this.config = config;
748
+ this.type = config.type;
749
+ this.shortDescription = config.shortDescription;
750
+ }
751
+ /**
752
+ * Gets the current value of the calculator.
753
+ * @param startDateInput The start date.
754
+ * @param endDateInput The end date.
755
+ */
756
+ SkyDateRangeCalculator.prototype.getValue = function (startDateInput, endDateInput) {
757
+ var result = this.config.getValue(startDateInput, endDateInput);
758
+ /* tslint:disable:no-null-keyword */
759
+ // (Angular form controls use null for the "empty" value.)
760
+ var startDate = null;
761
+ if (result.startDate instanceof Date) {
762
+ startDate = this.parseDateWithoutTime(result.startDate);
763
+ }
764
+ var endDate = null;
765
+ if (result.endDate instanceof Date) {
766
+ endDate = this.parseDateWithoutTime(result.endDate);
767
+ }
768
+ /* tslint:enable */
769
+ return {
770
+ calculatorId: this.calculatorId,
771
+ startDate: startDate,
772
+ endDate: endDate,
773
+ };
774
+ };
775
+ /**
776
+ * Performs synchronous validation against the control.
777
+ */
778
+ SkyDateRangeCalculator.prototype.validate = function (value) {
779
+ if (!this.config.validate) {
780
+ return;
781
+ }
782
+ return this.config.validate(value);
783
+ };
784
+ /**
785
+ * Get a date object without time information.
786
+ * See: https://stackoverflow.com/a/38050824/6178885
787
+ */
788
+ SkyDateRangeCalculator.prototype.parseDateWithoutTime = function (date) {
789
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
790
+ };
791
+ return SkyDateRangeCalculator;
792
+ }());
793
+
737
794
  /**
738
795
  * `SkyDateRangeCalculatorId` values specify calculator objects that return
739
796
  * two `Date` objects to represent date ranges. The values populate the options
@@ -3309,63 +3366,6 @@
3309
3366
  }]
3310
3367
  }] });
3311
3368
 
3312
- /**
3313
- * Represents the calculator.
3314
- */
3315
- var SkyDateRangeCalculator = /** @class */ (function () {
3316
- function SkyDateRangeCalculator(
3317
- /**
3318
- * Provides a calculator ID to specify calculator objects that represent date ranges.
3319
- */
3320
- calculatorId, config) {
3321
- this.calculatorId = calculatorId;
3322
- this.config = config;
3323
- this.type = config.type;
3324
- this.shortDescription = config.shortDescription;
3325
- }
3326
- /**
3327
- * Gets the current value of the calculator.
3328
- * @param startDateInput The start date.
3329
- * @param endDateInput The end date.
3330
- */
3331
- SkyDateRangeCalculator.prototype.getValue = function (startDateInput, endDateInput) {
3332
- var result = this.config.getValue(startDateInput, endDateInput);
3333
- /* tslint:disable:no-null-keyword */
3334
- // (Angular form controls use null for the "empty" value.)
3335
- var startDate = null;
3336
- if (result.startDate instanceof Date) {
3337
- startDate = this.parseDateWithoutTime(result.startDate);
3338
- }
3339
- var endDate = null;
3340
- if (result.endDate instanceof Date) {
3341
- endDate = this.parseDateWithoutTime(result.endDate);
3342
- }
3343
- /* tslint:enable */
3344
- return {
3345
- calculatorId: this.calculatorId,
3346
- startDate: startDate,
3347
- endDate: endDate,
3348
- };
3349
- };
3350
- /**
3351
- * Performs synchronous validation against the control.
3352
- */
3353
- SkyDateRangeCalculator.prototype.validate = function (value) {
3354
- if (!this.config.validate) {
3355
- return;
3356
- }
3357
- return this.config.validate(value);
3358
- };
3359
- /**
3360
- * Get a date object without time information.
3361
- * See: https://stackoverflow.com/a/38050824/6178885
3362
- */
3363
- SkyDateRangeCalculator.prototype.parseDateWithoutTime = function (date) {
3364
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
3365
- };
3366
- return SkyDateRangeCalculator;
3367
- }());
3368
-
3369
3369
  /**
3370
3370
  * Need to add the following to classes which contain static methods.
3371
3371
  * See: https://github.com/ng-packagr/ng-packagr/issues/641
@@ -5139,6 +5139,7 @@
5139
5139
 
5140
5140
  exports.SkyDatePipe = SkyDatePipe;
5141
5141
  exports.SkyDatePipeModule = SkyDatePipeModule;
5142
+ exports.SkyDateRangeCalculator = SkyDateRangeCalculator;
5142
5143
  exports.SkyDateRangePickerModule = SkyDateRangePickerModule;
5143
5144
  exports.SkyDateRangeService = SkyDateRangeService;
5144
5145
  exports.SkyDatepickerConfigService = SkyDatepickerConfigService;