Topic: Timepicker showing AM when default value is set to PM only for times starting with 12:

gregmahan priority asked 4 months ago


Expected behavior

When setting the value to times from 12:00pm -12:59pm, the timepicker will show that time with PM at the end

Actual behavior

Timepicker shows "AM"

Resources (screenshots, code snippets etc.)

I was having this issue with my own code, so I tested using code directly pulled from the documentation. My code:

    <div class="row">
    <div class="form-outline timepicker-default-time-string-pm" data-mdb-input-init>
        <input type="text" class="form-control" id="form27" />
        <label class="form-label" for="form27">With string PM</label>
    </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        const pickerStartedPM = document.querySelector('.timepicker-default-time-string-pm ');
        const tmStartedPM = new mdb.Timepicker(pickerStartedPM, {
            defaultTime: '12:12 PM'
        });
    });

My results

AM shows in box

This error is not reproducible with the snippet tool

https://mdbootstrap.com/snippets/standard/gregmahan/6020521


gregmahan priority commented 4 months ago

Any other PM times after 12:59pm (1pm through 11pm) seem to work fine.


Kamila Pieńkowska staff answered 4 months ago


Do you use 7.2.0 version? Does the code from your snippet works different in your project?

How are you doing your import? Do you get any console errors?

You're using JS init so $(document).ready is not needed.


gregmahan priority commented 4 months ago

Thank you for your response.I was on 6.2. I saw something last night about the 12:00 times in the change log for 6.4, so i spent the evening upgrading to 7.2.0 version. Problem is resolved.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.2.0
  • Device: PC
  • Browser: Firefox
  • OS: Win 11
  • Provided sample code: No
  • Provided link: Yes