Closed signalpoint closed 8 years ago
Is this still valid? I am still getting errors ... I did change options.bundle to my content type.
And is this code snippet supposed to also convert the node edit form to 12 hour format too with AM/PM? All the settings I change always show 24 hour format.
Using console.log(options)
is only showing the following. There is no options.resource == create or options.bundle == something from what I can find. Has something changed with hook_services_preprocess()
?
@mkinnan During preprocess, the bundle isn't yet known because it hasn't retrieved the node from the server yet, so it only knows the entity type (node) until we get back the fully loaded node, then it looks to the type
and stick it into bundle
so it's available in post processors. I see now that I suggested that was possible in my code above, but that is wrong and I'll update that post shortly.
Here's the spot in date.js
that needs some love in order to get 12 hour support working: https://github.com/signalpoint/date/blob/7.x-1.x/date.js#L444
@mkinnan But during that preprocess you should have access to the node
basics whether or not you're creating or editing a node, so I bet the bundle (aka node type) is hidden in the options
somewhere so you could limit it to certain content type(s).
@signalpoint I spent a while trying to find the bundle type in the options
but couldn't find it. I clicked through the entire options
object but didn't see a bundle or node type. I'll try looking again.
We now have 12/24 hour support. However depending on the date's widget, we may have mixed results. I've tested pretty thoroughly for the "Date" select list widgets.
Date select widgets work for 12 hour format.
12 hour format is not working for the display of the date/time when viewing the node. 24 hour format is still being displayed.
Right now if you try to create a node with a date field that is configured for 12 hour format, this module tries to POST a 24 hour format hour, which results in "an illegal choice has been detected". To get around this, you can implement something like this in a custom module: