I use Vue.js and Moment.js library to work with time and I need to compare the hours and minutes, not date. For example, I need to compare '12:00' and '13:45' and I use .isBefore function (docs).
I tried a bunch of functions and they work with dates, but not time exactly (I tried lots of examples, so this is last of them)
I use moment as a prototype, so $ is ok
let time = this.$moment('10:00-11:30'.split('-')[0], 'HH:mm').format('HH:mm');
let time2 = this.$moment(new Date(), 'HH:mm').format('HH:mm');
console.log({time, time2});
console.log(this.$moment(time.format('hh:mm').isBefore(this.$moment('12:00'), 'hh:mm'))
console.log(this.$moment(time, 'hh:mm').format('hh:mm').isBefore(this.$moment(time2).format('hh:mm'), 'hh:mm'))
console.log(this.$moment(this.$moment('10:00', 'HH:mm').format('HH:mm')).isBefore(this.$moment('12:00'),'HH:mm'));
console.log(this.$moment(this.$moment('10:00', 'HH:mm').format('HH:mm')).isBefore(this.$moment(time2).format('HH:mm'),'HH:mm'));
Some of them return false, but should return true, and some of them return error .isBefore is not a function.
I also find this, this and this, but it works only with exactly dates, but not only hours and minutes
Can someone help me to figure out what I did wrong?
 
    