Yes, you can apply the midyear convention to a stub period. The period between the valuation date/transaction date and the beginning of the financial year is considered a stub period. It is usually a fraction of a year or quarter as valuations can be done throughout the year and not just at the end of a period.
Take the period between the valuation date/transaction date and the beginning of the financial year as a fraction of the time period and divide it by two. Then, use that number as the time period to discount with.