@ledvance/base 1.1.97 → 1.1.99

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.
@@ -16,9 +16,16 @@ const loopsText = [
16
16
  I18n.getLang('timeschedule_add_schedule_weekday6_text'),
17
17
  ]
18
18
 
19
- export const loopText = (loop) => {
20
- const loopStrArray = loopsText.filter((_item, index) => Number(loop[index]) === 1)
21
- return loopStrArray.length == 7 ? I18n.getLang('motion_detection_time_schedule_notifications_field_weekdays_text4') : (loopStrArray.join(' ') || I18n.getLang('motion_detection_time_schedule_notifications_field_weekdays_text2'))
19
+ export const loopText = (loop, time = '') => {
20
+ let isToday = true
21
+ if(time){
22
+ const currentTime = dayjs()
23
+ const targetTime = dayjs().set('hour', parseInt(time.split(':')[0])).set('minute', parseInt(time.split(':')[1]));
24
+ const isBeforeCurrentTime = targetTime.isBefore(currentTime)
25
+ isToday = !isBeforeCurrentTime
26
+ }
27
+ const loopStrArray = loopsText.filter((_item, index) => Number(loop[index]) === 1)
28
+ return loopStrArray.length === 0 ? (I18n.getLang(isToday ? 'motion_detection_time_schedule_notifications_field_weekdays_text2' : 'motion_detection_time_schedule_notifications_field_weekdays_text3')) : loopStrArray.length === 7 ? I18n.getLang('motion_detection_time_schedule_notifications_field_weekdays_text4') : loopStrArray.join(' ')
22
29
  }
23
30
 
24
31
  const tommorrow = () => {