Quote:
Originally Posted by Kythe42
OK, thanks. I was able to get to the template editor and put in the code you gave me, with one or two tweaks to get the date format exactly how I want it. So far it seems to work, but what really surprised me was that it correctly formatted all the cells I had already entered in the text date field in the format of 06/02/2013 as June 02, 2013. So I guess it's not actually necessary for me to enter the text dates in ISO format(2013/06/02) if both ways work.
|
The date parser tries hard to understand the value passed to it.
That said, the only way the text column will sort correctly is if you use yyyy/mm/dd values.
Quote:
I also tested it in the UK date format which would be 02/06/2013 if I remember correctly. That way did not work and it interpreted the date as February 6th. If the code working for both formats(2013/12/31 and 12/31/2013) is a bug and you intend to fix it in future updates, please let me know so I can change all my dates to ISO format ahead of time.
|
This is not a bug unless you are in the UK and using UK locale settings. When a date is ambiguous, the date parser checks the locale and chooses the month and day from that.
Quote:
There are one or two other things. If an entry has nothing in the text field, then the composite column just shows the current year, 2013. Is there any way to get the composite column to show up as blank until a date is actually entered in the text field? It's not a huge deal I guess, it's just that in order to make adding my entries a bit less tedious I added 100 empty books when I started this library, so I've got lots of blank entries that show 2013 as a date.
|
Change the template to check for an empty field. You would check it first using something like test(y, stuff that is already in the template, '');
Quote:
I'm also wondering if there is a way to change the way that partial and full dates are sorted together? If I'm sorting them ascending then it will show the full dates first, then the dates where there's just the month and year, and the the dates where there's just the year last. So for example:
April 08, 2012
April 2012
2012
Preferably I'd want to see them in the reverse order from least complete dates to most complete dates. This doesn't actually apply to my needs because I only have full dates for books I've read starting in 2013 and all books read before 2013 I only have the year, but I'm just wondering if it can be done for curiosity's sake.
|
I think that if you use yyyy/mm/dd format in the text field then it will sort the way you want.
You might get away with sorting the composite column if you set the sort/search type to date, but I suspect that the partial dates will cause problems.
Quote:
Edit: As an afterthought I tried testing a partial date with the month and year in the US format 11/2012 and that didn't work with the code even though the full dates(and obviously just the year) were fine.
|
You must be consistent, and you must change the template so it gets the values from the right place. It will be much harder to code the template if you don't use yyyy/mm/dd
Quote:
I also did more testing on the sorting issue and I'm really bewildered now. Entries marked with just the year actually seem to be sorted in between July and August dates. As in:
March 2012
April 2012
May 2012
June 2012
July 2012
2012
August 2012
September 2012
October 2012
Again, this isn't actually an issue for me with my specific sorting needs, but it really doesn't look right at all sorted like that and I can see how it might be annoying for some people.
|
If you are sorting on the text column then you will get all sorts of bizarre results unless you are using yyyy/mm/dd format.