Skip to content

Commit ac6831f

Browse files
committed
MOBILE-4653 calendar: Remove uneeded clone on dayJS
1 parent 4040b71 commit ac6831f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/addons/calendar/components/calendar/calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI
520520
*/
521521
getPreviousItem(item: MonthBasicData): MonthBasicData | null {
522522
return {
523-
dayJS: item.dayJS.clone().subtract(1, 'month'),
523+
dayJS: item.dayJS.subtract(1, 'month'),
524524
};
525525
}
526526

@@ -529,7 +529,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI
529529
*/
530530
getNextItem(item: MonthBasicData): MonthBasicData | null {
531531
return {
532-
dayJS: item.dayJS.clone().add(1, 'month'),
532+
dayJS: item.dayJS.add(1, 'month'),
533533
};
534534
}
535535

src/addons/calendar/pages/day/day.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ export default class AddonCalendarDayPage implements OnInit, OnDestroy {
416416
if (selectedDay) {
417417
// Use current time but in the specified day.
418418
const now = dayjs.tz();
419-
params.timestamp = selectedDay.dayJS.clone().set({ hour: now.hour(), minute: now.minute() }).valueOf();
419+
params.timestamp = selectedDay.dayJS.set({ hour: now.hour(), minute: now.minute() }).valueOf();
420420
}
421421
}
422422

@@ -665,7 +665,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte
665665
*/
666666
getPreviousItem(item: DayBasicData): DayBasicData | null {
667667
return {
668-
dayJS: item.dayJS.clone().subtract(1, 'day'),
668+
dayJS: item.dayJS.subtract(1, 'day'),
669669
};
670670
}
671671

@@ -674,7 +674,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte
674674
*/
675675
getNextItem(item: DayBasicData): DayBasicData | null {
676676
return {
677-
dayJS: item.dayJS.clone().add(1, 'day'),
677+
dayJS: item.dayJS.add(1, 'day'),
678678
};
679679
}
680680

src/addons/calendar/services/calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,10 @@ export class AddonCalendarProvider {
543543
if (date.isSame(today, 'day')) {
544544
return Translate.instant('addon.calendar.today');
545545
}
546-
if (date.isSame(today.clone().subtract(1, 'days'), 'day')) {
546+
if (date.isSame(today.subtract(1, 'days'), 'day')) {
547547
return Translate.instant('addon.calendar.yesterday');
548548
}
549-
if (date.isSame(today.clone().add(1, 'days'), 'day')) {
549+
if (date.isSame(today.add(1, 'days'), 'day')) {
550550
return Translate.instant('addon.calendar.tomorrow');
551551
}
552552

0 commit comments

Comments
 (0)