The right for students to bring dates of the same gender to school functions has been recognized under federal protections, particularly following the Supreme Court's ruling in 2015 regarding same-sex marriage (Obergefell v. Hodges). However, the specific protections related to students bringing same-gender dates to school functions can also be based on existing anti-discrimination laws, including Title IX, which prohibits discrimination based on sex in educational settings.
While there may not be a specific federal law explicitly stating this right, many states and school districts have adopted policies that ensure equal treatment. Nonetheless, if you're looking for a specific year when it became broadly recognized or supported by federal precedent, the closest answer is since 2015.