The ngx-material-timepicker lacks proper design when the minutesGap is set to 1

https://i.sstatic.net/J4z5H.png

Check out this example of HTML code I have written:

<mat-form-field>
  <mat-label>StartTime</mat-label>
  <input matInput readonly [ngxTimepicker]="timeStart" [formControlName]="'startTime'" [format]="24" />
  <ngx-material-timepicker-toggle [for]="timeStart">
    <mat-icon svgIcon="mat_solid:access_time" ngxMaterialTimepickerToggleIcon></mat-icon>
  </ngx-material-timepicker-toggle>
  <ngx-material-timepicker #timeStart [minutesGap]="1" disabled="false"></ngx-material-timepicker>
</mat-form-field>

Answer №1

I successfully resolved this issue by adding the following custom CSS:

To differentiate this time picker from others and prevent interference, I created a new custom class called 'one-minute-gap' and applied CSS specifically to it.

Here is the code snippet from the component.html file:

<mat-form-field>
  <mat-label>StartTime</mat-label>
  <input matInput readonly [ngxTimepicker]="timeStart" [formControlName]="'startTime'" [format]="24" />
  <ngx-material-timepicker-toggle [for]="timeStart">
    <mat-icon svgIcon="mat_solid:access_time" ngxMaterialTimepickerToggleIcon></mat-icon>
  </ngx-material-timepicker-toggle>
  <ngx-material-timepicker #timeStart [minutesGap]="1" disabled="false" [timepickerClass]="'one-minute-gap'"></ngx-material-timepicker>
</mat-form-field>

And here is the corresponding CSS styles in the component.scss file:

::ng-deep .one-minute-gap {
    width: auto !important;
    ngx-material-timepicker-dial{
        .timepicker-dial{
            .timepicker-dial__container{
                justify-content: center !important;
            }
        }
    }
    ngx-material-timepicker-minutes-face {
        ngx-material-timepicker-face {
            .clock-face {
                width: 370px !important;
                height: 370px !important;
                padding: 5px !important;

                .clock-face__container {
                    .clock-face__number--outer {
                        height: calc(400px / 2 - 20px) !important;
                        span {
                            font-size: 12px !important;
                        }
                    }
                }
            }
        }
    }
}

After applying these changes, the time picker now looks like this:

https://i.sstatic.net/rdT8V.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Has an official Typescript declaration file been created for fabric.js?

Currently, I have come across a Typescript definition for fabric.js on https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fabric (https://www.npmjs.com/package/@types/fabric). However, its official status is unclear. Does anyone have more ...

Three.js functions smoothly on both Android devices and desktop computers using Chrome, unfortunately it is not compatible with Safari

After diving into learning three.js, I decided to incorporate it into my angular 11 project. I created a simple demo using a SphereBufferGeometry and deployed it on github pages. Surprisingly, when I accessed it on an android phone, everything worked perfe ...

Apply only the css style to the first adjacent div with a specific class name

Is it possible to apply a specific style to only the first div with the class "bla" and not the second? <div class="outer"> <div> ....(more div's, unknown how many) <div class="bla"> .... <div class="b ...

Error: React is throwing a SyntaxError because a ")" is missing in the argument list

While working on a React-typescript project using Vite, I encountered an issue where my page was displaying blank and showing the error : Uncaught SyntaxError: missing ) after argument list (at main.tsx:6:51) This error was found in the main.tsx file : im ...

Steps to create a formGroup in Angular 12

import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; @Component({ selector: 'app-signup', templateUrl: './signup.component.html', ...

Looking for a way to make certain pages in Vue3 accessible without authentication using KeyCloak-js

Currently, I am integrating keycloak-js adapter into a Vue 3 Application. The challenge I am facing is with the system's public pages, which prevent me from calling Keycloak immediately. Even though I have set up a button to trigger the login page, th ...

Issue: Nest is unable to export a component/module that is not included in the DatabaseModule module that is currently being processed

I am currently working on a simple app that involves implementing CRUD functionality on a PostgreSQL database using express. However, when I try to run my program, I encounter the following error message: Error: Nest cannot export component/module that is ...

Using jQuery to toggle CSS properties

I'm having trouble switching between a CSS column layout and a normal layout for a div element with the ID 'article'. The jQuery script I wrote doesn't seem to work properly, as the entire thing disappears. Can anyone advise me on how t ...

Combining ng-repeat with the float property set to left

I am attempting to create two rows of divs using ng-repeat. Each div is styled with a float: left attribute, and at the end, I add a clearing div with clear: both. <div class="interval" ng-repeat="interval in intervals"> <div class="text-cen ...

Guide to navigating to a different webpage with Node.js

I am a beginner user of NodeJS and I have a specific request. I need assistance with setting up a page redirect from one page to another upon clicking on a link. Any guidance provided will be greatly appreciated. Here is the code snippet: app.js var expr ...

Encountered an issue with formControlName being undefined during the render process in Angular 2

I encountered an issue while implementing Reactive form validation following the official Angular documentation. The error message "username not defined" is causing trouble in my project. Here's the detailed error: Error: Uncaught (in promise): Error: ...

I am experiencing an issue with mydaterangepicker and primeng where it is not displaying properly in the table header. Can anyone assist me with this

I am attempting to integrate mydaterangepicker () with primeng turbotable (since primeng calendar does not meet the requirements), but I am having trouble with its display. Could you please assist me with some CSS code or suggest an alternative solution? ...

Getting the Class name in Typescript

How can you retrieve the class name from within a Class in typescript? For instance, consider this code snippet: export class SomeRandomName extends AbstractSomething<SomeType> implements OnDestroy { className = 'SomeRandomName'; Is th ...

Struggling to effectively work with ArrayForm when trying to include additional form fields

I'm attempting to add a playlist in Mat-dialog that contains songs in a list using (formArray) as shown here: https://i.stack.imgur.com/diWnm.png However, I am unsure of the mistake I might be making This is how my dialogue appears: https://i.stac ...

Respond to unsuccessful changes within a simple presentational element

Within my component, I have a feature that allows users to interact with and modify a specific entity. However, these modifications may be rejected at the server level. In such cases, I would like the component to initiate an animation to indicate to the u ...

A unique feature where a bar emerges from the bottom of the screen, smoothly glides upwards, and then securely fastens to

I'm working on bringing to life a concept that I've been envisioning. The design would feature a long scrolling page with a unique navigation bar behavior. The idea is for the navigation bar to initially start at the bottom of the screen and the ...

Struggling with Getting My Animation to Function Correctly

I am trying to create a JQuery Animation that will move a div covering a text box up into the border when clicked. Despite multiple attempts, I can't seem to get the animation to work properly. Any suggestions? JavaScript function moveup(title,text ...

Make sure to call the child API only after the parent API in your

Currently facing an issue where I have two entities - child and parent, each with its own API and a one-to-many relationship. The parent component contains the child component within it, allowing users to create children when creating a new parent. How c ...

Merge ReactCssTransitionGroup with React-route's Link to create smooth page transitions

React.js I'm facing an issue with the React.js code provided below. My goal is to set up the animation before transitioning to a new page using "React-router.Link" and ReactCSSTransitionGroup. Version: react: '15.2.1' react-addons-css-trans ...

My component is missing the ChangeDetectorRef in Nativescript

I am attempting to automatically update an array within a Listview by utilizing ChangeDetectorRef in the following way: import { Component, OnInit, ChangeDetectionStrategy, Input, ChangeDetectorRef } from "@angular/core"; @Component({ selector: "regi ...