What is the format of the hours array for opt.hoursAvailable when using the US am/pm time format

What is the format of the hours array for opt.hoursAvailable when using the US am/pm time format

paul@dmcreative.compaul@dmcreative.com Posts: 24Questions: 4Answers: 0

The following works with 24 hour time format

hoursAvailable: [7,8,9,10,11,12,13,14],

What is the correct format of the hoursAvailable array for 12 hour am/pm format?

format: 'MM/DD/YYYY h:mm a'

I tried the array format for 24 hour time but that does not work. You can not select anything after 11:00 am (can not select pm button)
I have tried many "string variants" such as '7p' '7P' '7 p' '7 P' '7pm' with no success

Example of Editor Form Field Definition

{
    label: "Date / Time",
    name: "DATETIME_APT",
    id: "DATETIME_APT",
    type: 'datetime',
    keyInput: false,
    format: 'MM/DD/YYYY h:mm a' ,
    opts: {
        hoursAvailable: [7,8,9,10,11,12,13,14],
    }
}

Answers

  • colincolin Posts: 14,709Questions: 1Answers: 2,511

    Yep, it looks like there's a bug there. The format is correct, but it's not allowing you to flip between the AM and PM times - here's an example - try clicking on New and changing the time of the start date field. I've raised it internally (DD-2393 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • paul@dmcreative.compaul@dmcreative.com Posts: 24Questions: 4Answers: 0

    Thanks for confirming I had not lost my mind!!!

    I will await updated information.

    Paul

  • paul@dmcreative.compaul@dmcreative.com Posts: 24Questions: 4Answers: 0

    Any update on this issue?

  • allanallan Posts: 58,289Questions: 1Answers: 9,325 Site admin

    Hi Paul,

    Apologies for the delay on this - it fell off my radar. I've just made a change to DateTime which partly fixes this. It allows the toggle to happen, but when you toggle it will automatically select the corresponding value for the new range. e.g. If you had 3pm selected, it will automatically select 3am now (regardless of whether 3am is in the allowed list or not).

    The reason for this is that the display is coupled to the value - if it is an AM value then the AM range will show, likewise for PM. It isn't possible at the moment to show AM options when a PM value is selected. That this something that is going to need to be added to the library to allow this to work fully.

    Allan

  • paul@dmcreative.compaul@dmcreative.com Posts: 24Questions: 4Answers: 0

    Allan will you be able to fix this or do i need to migrate to a different date time picker?

  • allanallan Posts: 58,289Questions: 1Answers: 9,325 Site admin

    Hi Paul,

    There isn't an immediate plan to fix this I'm sorry to say. It would require a potentially significant re-think of how the control works, since it would need the value to be decoupled from the DOM (at the moment we can always just read the value back).

    I agree that this is something that does need to be fix though. I've got a bug for it that I will look into when I'm working on DateTime for its next release.

    Allan

Sign In or Register to comment.