Skip to content

smart: read and compare dates as rekordbox does - #96

Merged
vynulldev merged 3 commits into
mainfrom
conformance-smart-dates
Oct 17, 2026
Merged

vynulldev merged 3 commits into
mainfrom
conformance-smart-dates

Conversation

@vynulldev

@vynulldev vynulldev commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

What & why

Imported smart playlists with date rules matched different tracks from rekordbox's. link-spec's date suites (and its disassembly of rekordbox's dateToDay, pastDayToDay and pastMonthToDay) show how rekordbox reads and compares dates, and Vynull now does the same.

Reading dates (library.ParseRekordboxDate, used for track dates on import and for rule values)

  • rekordbox reads the year, month and day from fixed positions of a 10-character value and ignores the characters between them, so 2025/01/31, 2025.01.31 and 2025 01 31 are all January 31.
  • Out-of-range days and months still make a date (2025-02-29 rolls over as the C runtime does).
  • Anything else is no date: another length (single-digit fields, a time part, surrounding spaces), anything on or before 1970-01-01, and year 9999.
  • A track with a blank or malformed date now has no date and matches no date rule. Before, the import gave a blank or malformed StockDate today's date, so those tracks matched "is not" and "after" rules.

Relative rules ("in the last" and "not in the last")

  • "In the last n days" starts n-1 days back, so "1 day" is today. Later dates, including future ones, are included.
  • "In the last n months" starts on the last day of the month n months back, so 1 month on March 31 starts on February 29 in a leap year.
  • Only the unit month, in any letter case, counts months. Every other unit counts days, including week, year, plurals and unknown units.
  • The count is read as an integer (1.5 is 1), and a count below 1 counts as 1.
  • "Not in the last" keeps dated tracks before the start.

Release date: dateReleased rules now work. The import keeps rekordbox's ReleaseDate, which the dump tool now exports.

Showing the dates:

  • The track info API now includes date_created and release_date (YYYY-MM-DD, imported tracks only), and the OpenAPI spec lists them.
  • The track drawer shows them as CREATED and RELEASED.
  • The track table offers them as optional columns.

Web editor:

  • It lists Date created and Release date, and the date operators imported rules use: not in the last (days), in and not in the last (months), is, is not and between.
  • Before, an imported rule on a field the editor didn't list showed up as BPM.
  • Date rule values may be plain YYYY-MM-DD, which is what the editor's date input produces.

Conformance against rekordbox 7.2.19 goes from 2,764 to 2,876 of 4,250 exact (+112, none lost). The three date matrices now match in full: smart-date-matrix 30/30, smart-relative-date-matrix 56/56, smart-date-format-matrix 117/117. The rest of smart-serving-crosses is out of this PR's scope:

  • the sort and render-argument-8 secondary column, which no track list implements yet;
  • requester players 2 to 6, which rekordbox answers only after seeing them on the network.

Hardware testing

  • Tested on: CDJ-2000NXS2

Checklist

  • go build ./..., go vet ./..., and go test ./... pass
  • gofmt -l . is clean
  • New source files carry an SPDX header (GPL-3.0-or-later)
  • Tested on real hardware (deck + firmware noted above), or this change doesn't affect deck behaviour
  • I agree my contribution is licensed under the project's GPLv3

@vynulldev vynulldev added the bug Something isn't working label Oct 17, 2026
rekordbox reads a date by position from a 10-character value, ignoring
the separators, and keeps out-of-range days and months as dates; a blank
or malformed date is no date and matches no date rule. Imports no longer
give such tracks today's date, and rule values are read the same way.

Relative rules follow pastDayToDay and pastMonthToDay: the last n days
start n-1 days back, the last n months start on the last day of the month
n months back, only the unit month counts months, and a count below one
counts as one. dateReleased rules now test the track's release date,
which the import now keeps.

The web editor lists date created, release date, and the imported date
operators, and date rule values may be plain YYYY-MM-DD.
Tracks imported from rekordbox carry its DateCreated and ReleaseDate,
which smart playlist rules test but nothing displayed. The track info
now includes them as date_created and release_date, the track drawer
shows them as CREATED and RELEASED, and the track table offers them as
optional columns.
rbCount duplicated the integer reading rbInt now does for numeric rule
values; relative-date counts use rbInt.
@vynulldev
vynulldev force-pushed the conformance-smart-dates branch from 00e2b24 to 0a326e3 Compare October 17, 2026 22:11
@vynulldev
vynulldev marked this pull request as ready for review October 17, 2026 22:50
@vynulldev
vynulldev merged commit bd10e66 into main Oct 17, 2026
1 check passed
@vynulldev
vynulldev deleted the conformance-smart-dates branch October 17, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant