stash icon indicating copy to clipboard operation
stash copied to clipboard

[Feature] Support shorter dates like YYYY-MM and YYYY

Open Telkhine opened this issue 3 years ago • 9 comments

The day of month or even the month is not known on many files. Currently only YYYY-MM-DD date format is supported. Could we also support YYYY-MM and YYYY?

Is your feature request related to a problem? Please describe. When I try to enter a YYYY-MM or YYYY as the date, I get no error. It seems like it's going to accept the value, but it doesn't get saved.

Describe the solution you'd like I'd like see support for YYYY-MM and YYYY, e.g. 2021 or 2021-07.

Describe alternatives you've considered If for some reason the month and day of month can't be blank, maybe allow for something like this: 2021-00-00

Telkhine avatar Jul 13 '21 15:07 Telkhine

While IMO a valid request this sadly isn't possible. This as most, if not all, date fields are stored in the database as an actual date (this so it's also possible to make calculations, like performers age or performers age in scene). But this at the same time thus doesn't allow to enter invalid dates. So the only work around would be to enter a valid date like 2021-01-01.

gitgiggety avatar Jul 13 '21 16:07 gitgiggety

That's what I currently do, but it's very messy and misleading. Probably more than half the files I have, I don't know the day or month for.

How about this: If a user only enters YYYY-MM or YYYY, it auto translates the day/month to 01, then hides it from the user.

Ex: 2011 becomes 2011-01-01 in the DB, but on the frontend it only shows 2011.

If a user acually enters 2011-01-01, it would obvioulsy show the full date.

Telkhine avatar Jul 13 '21 16:07 Telkhine

I've been thinking about this. The other way the could be implemented is if dates were stored as integers, then cast to a date format when needed. If only the year was stored, then a casting function would automatically assume January 1 as the month and day. There would also need to be valid date checking before a value is stored.

Telkhine avatar Sep 09 '21 17:09 Telkhine

I found some talk about doing this on the SQLite forums here: https://sqlite.org/forum/info/2cc59407217aa1a8

For this approach, the scene date would need to be changed to a TEXT field, then have dates stored something like this:

complete date:    2021-06-29
year-month:       2021-06-..
year:             2021-..-..

Functions would then handle this data in one of two ways:

  1. Read the dates as-is. ex: displaying the data on a page
  2. Convert the data to an actual date, so 2021-06-.. becomes 2021-06-01. ex: sorting functions

If we only care about YYYY, YYYY-MM and YYYY-MM-DD, then maybe the ".." stuff is unnecessary. On the forum post, the guy also cared about ....-MM-.. and ....-..-DD. For the use case here, I don't think that's needed.

I don't know if there is any will or desire for this, but personally having so much junk data for my files is driving me nuts.

EDIT: I'd be willing to place a $50 bounty for this feature, if approved for it. I know the dev time required for rewiring a lot of stuff is worth way more than that, but it's about as much as I can afford.

Telkhine avatar Jul 07 '22 19:07 Telkhine

While IMO a valid request this sadly isn't possible. This as most, if not all, date fields are stored in the database as an actual date (this so it's also possible to make calculations, like performers age or performers age in scene). But this at the same time thus doesn't allow to enter invalid dates. So the only work around would be to enter a valid date like 2021-01-01.

~~The backend allows storing partial date, it's the UI that doesn't allow it.~~

Database supports partial dates, but the Go backend and UI needs to be updated.

DogmaDragon avatar Mar 07 '23 10:03 DogmaDragon