如何利用Angular的Kendo-Datepicker格式的首字母?

发布于 2025-01-28 17:06:32 字数 783 浏览 4 评论 0原文

我有一个kendo-datepicker,它总是像以下那样在字段中显示格式。

但我想将其自定义为月/天/年。大写第一个字母。是否可以这样自定义。

.html

<form [formGroup]="myForm">

    <label for="address" class="col-sm-2 col-form-label">Date</label>
    
     <div class="col-sm-4">
    
         <kendo-datepicker formControlName="startingDate" format="MM/dd/yyyy">
         </kendo-datepicker>
    
      </div>
 </form>

.ts

myForm: FormGroup = new FormGroup({
    startingDate: new FormControl(""),
  });

I have a kendo-datepicker and it's always displaying the format in the field like following.
enter image description here

But I want to customize this as Month/Day/Year. Capitalize the first letter. Is it possible to customize like this.

.html

<form [formGroup]="myForm">

    <label for="address" class="col-sm-2 col-form-label">Date</label>
    
     <div class="col-sm-4">
    
         <kendo-datepicker formControlName="startingDate" format="MM/dd/yyyy">
         </kendo-datepicker>
    
      </div>
 </form>

.ts

myForm: FormGroup = new FormGroup({
    startingDate: new FormControl(""),
  });

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

春庭雪 2025-02-04 17:06:32

我将覆盖CSS的日期输入。类似的内容:

.k-dateinput > .k-input-inner {
    text-transform: capitalize;
}

工作示例:

I would override css for date input. Something like this:

.k-dateinput > .k-input-inner {
    text-transform: capitalize;
}

Working example: Capitalize date format in form group

同尘 2025-02-04 17:06:32

它是通过覆盖 k输入 CSS类来固定的。

 :host::ng-deep .k-input {
        text-transform: capitalize;
      }

It's fixed by overriding the k-input CSS class.

 :host::ng-deep .k-input {
        text-transform: capitalize;
      }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文