The documentation for the date form element mentions that the default value should be passed as an array but this is not correct, it should instead be passed as a string in the format 'YYYY-MM-DD', which is ISO-8601 extended.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 2892101-14.patch | 1.08 KB | prithvi1972 |
| #10 | interdiff-2-10.txt | 1.06 KB | ada hernandez |
| #10 | 2892101-10.patch | 1.31 KB | ada hernandez |
Comments
Comment #2
pfrenssenComment #5
ejk commentedWhat needs to be done to get this fixed in the Documentation? Lost an hour to this today, and would like to keep others from the same. Never contributed before but am glad to help any way I can.
Comment #6
girish-jerk commentedPatch #2.
Looks fine............!
Comment #7
borisson_The docs here are indeed wrong.
#5, #6 also both agree on that on.
Comment #8
alexpottI think this is a bit more complex. The format of the date is not always
Y-m-dit is whatever you've set#date_date_formattoo. I think we should adapt the following documentation from Datetime:and document
#date_date_formatand the relationship between #default_value and #date_date_format.Comment #9
pfrenssenThanks all for the sudden flurry of activity!
@ejk, if you are looking to make a first contribution, maybe you can try updating the documentation in this patch according to @alexpott's suggestions?
I can help you if you have any questions about how to do this. If you need some information to get you started on rolling a patch, you can start with reading Contribute a patch.
Comment #10
ada hernandez commenteddocumentation modified like @alexpott suggested
Comment #11
pfrenssenThere are a few things here that are not correct:
#default_value. There is no#date_date_formatproperty on this form element.It looks like the documentation from the date format string has been copied, but that's not the intention. Instead we need to describe that the value passed is adhering to this format.
Comment #12
ada hernandez commented@pfrenssen Ok, I understood, I have a second attempt, tell me what do you think:
Comment #13
robpowell@Adita, it looks like you forget your second attempt patch.
Comment #14
prithvi1972 commentedMade some changes adhering to #11.
Comment #15
prithvi1972 commentedChanged comments according to #11 in #14
Comment #16
rakesh.gectcrComment #17
wim leersThere was a recent blog post about this: https://blog.purdy.info/2018/07/drupal-8-date-form-field.html (found it via The Weekly Drop 🙏). Let's get this done!
Comments #14 and #15 were unpublished automatically because @prithvi1972 was a very new d.o user. Sorry about that, @prithvi1972!
That being said, the #14 patch did what #12 suggested, and that is still mentioning
#date_date_format. That is irrelevant here AFAICT. So this patch still needs work, because the docs AFAICT still don't entirely make sense.Comment #19
eclipsegc commentedSo, reading through this issue, it seems that #date_date_format certainly does impact the #default_value. That being said, it seems like a longer and more contentious issue than should block what are CLEARLY incorrect docs. Can we consider something more along the lines of #2 but with a SLIGHTLY more nuanced description that doesn't mention ISO-8601 since that's clearly only correct sometimes? We could file a follow up to more correctly describe the #date_date_format and not blocks this issue further.
Just a thought,
Eclipse
Comment #20
volkswagenchickTagging for DrupalNorth 2019
Comment #22
nitesh624Comment #23
nitesh624This is duplicate issue
Comment #24
nitesh624Comment #25
atul4drupal commentedThis issue seems duplicate of https://www.drupal.org/project/drupal/issues/2944552 where it has been addressed.
Also the #date_date_format related issue is been handled as a separate issue @ https://www.drupal.org/project/drupal/issues/2836530
#default_value : https://www.drupal.org/project/drupal/issues/2944552
#date_date_format : https://www.drupal.org/project/drupal/issues/2836530
Comment #26
idebr commentedComment #27
nitesh624Unassigning issue from me as it closed