Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
HTML - Input format 'mm:ss'?

I want to have field in Backpack Laravel as an input with format of mm:ss ? i tried the code below but it's giving me format of hh:mm :

<input
        type="time"
        min="00:00"
        max="59:59"
        name="{{ $field['name'] }}"
        value="{{ old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : '' )) }}"
        @include('crud::fields.inc.attributes')
>

How can i do that ?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This is my solution using JS :

@include('crud::fields.inc.wrapper_start')
    <label>{!! $field['label'] !!}</label>
    <input
        type="text"
        id="time"
        placeholder="--:--"
        maxlength="5"
        name="{{ $field['name'] }}"
        value="{{ old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : '' )) }}"
        @include('crud::fields.inc.attributes')
    >

    {{-- HINT --}}
    @if (isset($field['hint']))
        <p class="help-block">{!! $field['hint'] !!}</p>
    @endif
@include('crud::fields.inc.wrapper_end')

@push('crud_fields_scripts')
    <script>
        (function($, undefined) {
            "use strict";
            $(function() {
                $('#time').on( "keyup", function( event ) {
                    let selection = window.getSelection().toString();
                    if ( selection !== '' ) {
                        return;
                    }

                    if ( $.inArray( event.keyCode, [38,40,37,39] ) !== -1 ) {
                        return;
                    }

                    let $this = $(this);
                    let input = $this.val();
                    input = input.replace(/[\W\s\._\-\D]+/g, '');

                    let split = 2;
                    let chunk = [];

                    for (let i = 0, len = input.length; i < len; i += split) {
                        chunk.push( input.substr( i, split ) );
                    }

                    $this.val(function() {
                        return chunk.join(":");
                    });

                } );
            });
        })(jQuery);
    </script>
@endpush

about 4 years ago · Juan Pablo Isaza Report

0

this worked for me:

CRUD::addField([
        'name' => 'accounting_date',
        'type'  => 'datetime_picker',
        'label' => 'Abrechnungszeitraum',
        'wrapper' => ['class' => 'form-group col-md-3'],
        
        'datetime_picker_options' => [
            'format'   => 'mm:ss',
            'language' => 'de',
         ]            
    ]);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!