代码之家  ›  专栏  ›  技术社区  ›  ananya

在<owl date time>中更改按钮文本并从日期中删除AM/PM

  •  0
  • ananya  · 技术社区  · 7 年前

    我正在使用“ https://www.npmjs.com/package/ng-pick-datetime “此库用于日期时间选取器。 enter image description here https://stackblitz.com/github/DanielYKPan/owl-examples/tree/date-time-picker . 我想更改的按钮文本 “设置”为“应用” .

    将日期设置为输入字段后,将显示 上午/下午 。我要删除它。 有人能帮我怎么做吗。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Capo    7 年前

    根据本地化标签和消息部分中的文档,可以通过OwlDateTimeIntl自定义这些字符串- docs :

    选择器使用的各种文本字符串是通过OwlDateTimeIntl提供的。

    import { OwlDateTimeModule, OwlNativeDateTimeModule, OwlDateTimeIntl} from 'ng-pick- 
    datetime';
    
    
    export class DefaultIntl extends OwlDateTimeIntl = {
    
    /** A label for the cancel button */
    cancelBtnLabel= 'Cancel',
    
    /** A label for the set button */
    setBtnLabel= 'Set',
    
    /** A label for the hour12 button (AM) */
    hour12AMLabel= 'AM',
    
    /** A label for the hour12 button (PM) */
    hour12PMLabel= 'PM',
    };
    
        2
  •  0
  •   Omar Salvatore    7 年前

    使用此代码:

    export class DefaultIntl extends OwlDateTimeIntl {
      /** A label for the cancel button */
      cancelBtnLabel= 'Cancelar';
    
      /** A label for the set button */
      setBtnLabel= 'Aceptar';
    };
    

        3
  •  0
  •   Parthan_akon    6 年前

    更改的唯一方法是转到根文件,即转到ng pick date time文件夹,然后转到“date-time-picker-intl.service.js”文件,在该文件中可以更改

    this.setBtnLabel = 'Set'; 
    

     this.setBtnLabel = 'Apply';
    
    推荐文章