Adam Shaw 7 лет назад
Родитель
Сommit
60ecc6a33c
4 измененных файлов с 8 добавлено и 8 удалено
  1. 5 5
      src/component/DateComponent.ts
  2. 1 1
      src/datelib/duration.ts
  3. 1 1
      src/exports.ts
  4. 1 1
      tasks/ts-types.js

+ 5 - 5
src/component/DateComponent.ts

@@ -764,18 +764,18 @@ export default abstract class DateComponent extends Component {
   // Compute the number of the give units in the "current" range.
   // Won't go more precise than days.
   // Will return `0` if there's not a clean whole interval.
-  currentRangeAs(unit) {
+  currentRangeAs(unit) { // PLURAL :(
     const dateEnv = this._getCalendar().dateEnv
     let range = this._getDateProfile().currentUnzonedRange
     let res = null
 
-    if (unit === 'year') {
+    if (unit === 'years') {
       res = dateEnv.diffWholeYears(range.start, range.end)
-    } else if (unit === 'month') {
+    } else if (unit === 'months') {
       res = dateEnv.diffWholeMonths(range.start, range.end)
-    } else if (unit === 'week') {
+    } else if (unit === 'weeks') {
       res = dateEnv.diffWholeMonths(range.start, range.end)
-    } else if (unit === 'day') {
+    } else if (unit === 'days') {
       res = diffWholeDays(range.start, range.end)
     }
 

+ 1 - 1
src/datelib/duration.ts

@@ -189,7 +189,7 @@ export function greatestDurationDenominator(dur: Duration, dontReturnWeeks?: boo
     if (time % 1000 !== 0) {
       return { unit: 'millisecond', value: time }
     }
-    if (time % (1000 * 60) ! == 0) {
+    if (time % (1000 * 60) !== 0) {
       return { unit: 'second', value: time / 1000 }
     }
     if (time % (1000 * 60 * 60) !== 0) {

+ 1 - 1
src/exports.ts

@@ -123,7 +123,7 @@ export { DateMarker, addDays, startOfDay, addMs, diffWholeWeeks, diffWholeDays,
 export {
   Duration, createDuration,
   isSingleDay, multiplyDuration,
-  asRoughMinutes, asRoughSeconds,
+  asRoughMinutes, asRoughSeconds, asRoughMs,
   wholeDivideDurations, greatestDurationDenominator
 } from './datelib/duration'
 export { DateEnv } from './datelib/env'

+ 1 - 1
tasks/ts-types.js

@@ -65,7 +65,7 @@ function filterModuleBody(s) {
 
   if (defaultExportName) {
     // replace any references to the original class' name
-    s = s.replace(new RegExp('\\b' + defaultExportName + '\\b'), 'Default')
+    s = s.replace(new RegExp('\\b' + defaultExportName + '\\b', 'g'), 'Default')
 
     // still needs to be exported as default
     s += '\n\texport default Default;'