Skip to content

Commit 7d2f99d

Browse files
committed
Remove now-unused Date/Time methods: getFieldFloor, getFieldCieling, daysInMonth
1 parent efb9127 commit 7d2f99d

2 files changed

Lines changed: 0 additions & 89 deletions

File tree

examples/browser/cql4browsers.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,42 +1034,6 @@ class AbstractDate {
10341034
return result;
10351035
}
10361036
}
1037-
getFieldFloor(field) {
1038-
switch (field) {
1039-
case 'month':
1040-
return 1;
1041-
case 'day':
1042-
return 1;
1043-
case 'hour':
1044-
return 0;
1045-
case 'minute':
1046-
return 0;
1047-
case 'second':
1048-
return 0;
1049-
case 'millisecond':
1050-
return 0;
1051-
default:
1052-
throw new Error('Tried to floor a field that has no floor value: ' + field);
1053-
}
1054-
}
1055-
getFieldCieling(field) {
1056-
switch (field) {
1057-
case 'month':
1058-
return 12;
1059-
case 'day':
1060-
return daysInMonth(this.year, this.month);
1061-
case 'hour':
1062-
return 23;
1063-
case 'minute':
1064-
return 59;
1065-
case 'second':
1066-
return 59;
1067-
case 'millisecond':
1068-
return 999;
1069-
default:
1070-
throw new Error('Tried to ceiling a field that has no cieling value: ' + field);
1071-
}
1072-
}
10731037
}
10741038
class DateTime extends AbstractDate {
10751039
static parse(string) {
@@ -1725,13 +1689,6 @@ function compareWithDefaultResult(a, b, defaultResult) {
17251689
// if we made it here, then all fields matched.
17261690
return true;
17271691
}
1728-
function daysInMonth(year, month) {
1729-
if (year == null || month == null) {
1730-
throw new Error('daysInMonth requires year and month as arguments');
1731-
}
1732-
// Month is 1-indexed here because of the 0 day
1733-
return new util_1.jsDate(year, month, 0).getDate();
1734-
}
17351692
function isValidDateStringFormat(string) {
17361693
if (typeof string !== 'string') {
17371694
return false;

src/datatypes/datetime.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -523,44 +523,6 @@ abstract class AbstractDate {
523523
return result;
524524
}
525525
}
526-
527-
getFieldFloor(field: any) {
528-
switch (field) {
529-
case 'month':
530-
return 1;
531-
case 'day':
532-
return 1;
533-
case 'hour':
534-
return 0;
535-
case 'minute':
536-
return 0;
537-
case 'second':
538-
return 0;
539-
case 'millisecond':
540-
return 0;
541-
default:
542-
throw new Error('Tried to floor a field that has no floor value: ' + field);
543-
}
544-
}
545-
546-
getFieldCieling(field: any) {
547-
switch (field) {
548-
case 'month':
549-
return 12;
550-
case 'day':
551-
return daysInMonth(this.year, this.month);
552-
case 'hour':
553-
return 23;
554-
case 'minute':
555-
return 59;
556-
case 'second':
557-
return 59;
558-
case 'millisecond':
559-
return 999;
560-
default:
561-
throw new Error('Tried to ceiling a field that has no cieling value: ' + field);
562-
}
563-
}
564526
}
565527

566528
export class DateTime extends AbstractDate {
@@ -1342,14 +1304,6 @@ function compareWithDefaultResult(a: any, b: any, defaultResult: any) {
13421304
return true;
13431305
}
13441306

1345-
function daysInMonth(year: number | null, month: number | null) {
1346-
if (year == null || month == null) {
1347-
throw new Error('daysInMonth requires year and month as arguments');
1348-
}
1349-
// Month is 1-indexed here because of the 0 day
1350-
return new jsDate(year, month, 0).getDate();
1351-
}
1352-
13531307
function isValidDateStringFormat(string: any) {
13541308
if (typeof string !== 'string') {
13551309
return false;

0 commit comments

Comments
 (0)