hmrc / tax-year   0.3.0-3-gbc9c4a1

Apache License 2.0 GitHub
Scala versions: 2.11

tax-year

Download

This is a UK tax year utility. Therefore, it uses the Europe/London timezone.

Change History

v4.0 - 05 Dec 23

  • update Scala 2.13 version
  • update library dependencies
  • add 'Change History' section to README

v3.3.0 - 01 Aug 23

  • add README instructions

v3.2.0 - 06 May 22

  • update Scala version

v2.0.0 - 07 Apr 22

  • drop redundant scalatestplus-play dependency
import uk.gov.hmrc.time.TaxYear

Features

  • getting the tax year for a given date
TaxYear.taxYearFor(LocalDate.of(2023, 7, 21)) // 2023 to 2024
  • getting the current tax year
TaxYear.current // 2023 to 2024
  • determining the extent of a tax year
TaxYear.current.starts   // 2023-04-06
TaxYear.current.finishes // 2024-04-05
  • navigating tax years
TaxYear.current.previous // 2022 to 2023
TaxYear.current          // 2023 to 2024
TaxYear.current.next     // 2024 to 2025
  • go back or forward by given tax years
TaxYear.current.back(2)     // 2021 to 2022
TaxYear.current.forwards(2) // 2025 to 2026
  • determine if given date is within the tax year
TaxYear.current.contains(LocalDate.of(2023, 4, 5)) // false
TaxYear.current.contains(LocalDate.of(2023, 4, 6)) // true
  • support scala 2.13 with version 2 and above
  • support for scala 2.11 dropped from version 3

Adding tax-year as a dependency

"uk.gov.hmrc" %% "tax-year" % "[INSERT_VERSION]"

License

This code is open source software licensed under the Apache 2.0 License.