All the intervals we’ve seen so far have been harmonic intervals -
Intervals between consecutive notes (i.e. notes played one after the other) are called melodic intervals. When you identify melodic intervals, always work from the lowest pitched note, even if this is played after the top note in the interval.
In this example, the intervals bracketed in the treble clef are melodic intervals and those bracketed in the bass clef are harmonic intervals.
The minor 3rd melodic interval is reckoned from G# up to B (not from B “up to” G#)!!
Knowing the G# (Ab) major scale gives the 3rd note as B# (C natural). The B here is a semitone “flatter” hence the minor 3rd interval.