Adam Shaw 7 роки тому
батько
коміт
d9eac119ce

+ 1 - 1
src/Calendar.ts

@@ -943,7 +943,7 @@ export default class Calendar {
       return null
     }
 
-    if (start && end && end.isBefore(start)) {
+    if (start && end && end < start) {
       return null
     }
 

+ 1 - 1
src/DateProfileGenerator.ts

@@ -269,7 +269,7 @@ export default class DateProfileGenerator {
 
     function computeRes() {
       start = dateEnv.startOf(date, alignment)
-      end = dateEnv.add(date, duration)
+      end = dateEnv.add(start, duration)
       res = new UnzonedRange(start, end)
     }
 

+ 1 - 1
src/OptionsManager.ts

@@ -76,7 +76,7 @@ export default class OptionsManager extends Model {
       this.dynamicOverrides.locale,
       this.overrides.locale
     )
-    localeDefaults = getLocale(locale) // TODO: not efficient bc calendar already queries this
+    localeDefaults = getLocale(locale).options // TODO: not efficient bc calendar already queries this
 
     isRTL = firstDefined( // based on options computed so far, is direction RTL?
       this.dynamicOverrides.isRTL,

+ 1 - 1
src/View.ts

@@ -975,7 +975,7 @@ export default abstract class View extends InteractiveDateComponent {
       end = this.skipHiddenDays(end, -1, true)
     }
 
-    if (start === null || end === null || start < end) {
+    if (start == null || end == null || start < end) {
       return new UnzonedRange(start, end)
     }
 

+ 1 - 1
src/agenda/TimeGrid.ts

@@ -626,7 +626,7 @@ export default class TimeGrid extends InteractiveDateComponent {
 
 
   getHitFootprint(hit) {
-    const dateEnv = this.view.calendar.dateEnd
+    const dateEnv = this.view.calendar.dateEnv
     let start = this.getCellDate(0, hit.col) // row=0
     let timeMs = this.computeSnapTime(hit.snap) // pass in the snap-index
     let end

+ 1 - 1
src/basic/BasicView.ts

@@ -291,8 +291,8 @@ function makeDayGridSubclass(SuperClass) {
 
     // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
     renderNumberIntroHtml(row) {
-      const dateEnv = this.calendar.dateEnv
       let view = this.view
+      const dateEnv = view.calendar.dateEnv
       let weekStart = this.getCellDate(row, 0)
 
       if (view.colWeekNumbersVisible) {

+ 2 - 2
src/component/DayTableMixin.ts

@@ -63,9 +63,9 @@ export default class DayTableMixin extends Mixin implements DayTableInterface {
 
     if (this.breakOnWeeks) {
       // count columns until the day-of-week repeats
-      firstDay = dayDates[0].getUTCDate()
+      firstDay = dayDates[0].getUTCDay()
       for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) {
-        if (dayDates[daysPerRow].getUTCDate() === firstDay) {
+        if (dayDates[daysPerRow].getUTCDay() === firstDay) {
           break
         }
       }

+ 1 - 2
src/models/EventPeriod.ts

@@ -48,8 +48,7 @@ export default class EventPeriod {
 
 
   isWithinRange(start, end) {
-    // TODO: use a range util function?
-    return !start.isBefore(this.start) && !end.isAfter(this.end)
+    return start >= this.start && end <= this.end
   }