Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
js Daterange Picker time picker showing current time in time range

I want to show time from 00:00 to 23:59 in custom range option for time picker. By default custom range is selected for me. It works with predefined ranges but not with custom range. I couldn't find any option in docs to set time picker range for custom range time picker. Here is my initialization code.

            var start = {!! isset($_GET['from'])?"moment('".$_GET['from']."')":"moment().startOf('today')"  !!};
            var end = {!! isset($_GET['to'])?"moment('".$_GET['to']."')":"moment().endOf('today')"  !!};

            function cb(s, e) {
                start = s;
                end = e;
                $('#reportrange span').html(start.format('MMM D') + ' - ' + end.format('MMM D'));
            }

               $('#reportrange').daterangepicker({
                timePicker: true,
                timePicker24Hour: true,
                startDate: start,
                endDate: end,
                ranges: {
                    'Today': [moment().startOf('day'), moment().endOf('day')],
                    'Yesterday': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
                    'Last 7 Days': [moment().subtract(6, 'days').startOf('day'), moment().endOf('day')],
                    'Last 30 Days': [moment().subtract(29, 'days').startOf('day'), moment().endOf('day')],
                    'This Month': [moment().startOf('month').startOf('day'), moment().endOf('month').endOf('day')],
                    'Last Month': [moment().subtract(1, 'month').startOf('month').startOf('day'), moment().subtract(1, 'month').endOf('month').endOf('day')]
                }
            }, cb);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You just need to change moment startOf from today to day. Currently its not getting date so it selects custom range by default.

You can look in to moment docs

https://momentjs.com/docs/#/manipulating/start-of/

var start = {!! isset($_GET['from'])?"moment('".$_GET['from']."')":"moment().startOf('day')"  !!};
var end = {!! isset($_GET['to'])?"moment('".$_GET['to']."')":"moment().endOf('day')"  !!};
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda