From ee500c4957d16eb8537681baaf051bb4b8d0f276 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Tue, 30 Aug 2022 15:56:43 +0800 Subject: [PATCH] update ts-basic-components-textclock.md (7851) Signed-off-by: ester.zhou --- .../arkui-ts/ts-basic-components-textclock.md | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md index 5006310015..431cbcd11c 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md @@ -2,8 +2,9 @@ The **** component displays the current system time in text format for different time zones. The time is accurate to seconds. -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +>**NOTE** +> +>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -17,12 +18,12 @@ Not supported TextClock(options?: { timeZoneOffset?: number, controller?: TextClockController }) -- Parameters +**Parameters** - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | ---- | ------------------ | ------------------------------------------------------------ | - | timeZoneOffset | number | No | Time zone offset| Sets the time zone offset. The value range is [-14, 12], indicating UTC+12 to UTC-12. A negative value indicates Eastern Standard Time, and a positive value indicates Western Standard Time. For example, **-8** indicates UTC+8. For countries or regions crossing the International Date Line, use -13 (UTC+13) and -14 (UTC+14) to ensure consistent time within the entire country or region. | - | contorller | [TextClockContorller](#textclockcontroller) | No| null | Binds a controller to control the status of the **** component. | +| Name | Type| Mandatory| Default Value | Description | +| -------- | -------- | ---- | ------------------ | ------------------------------------------------------------ | +| timeZoneOffset | number | No | Time zone offset of the current system| Time zone offset.
The value range is [-14, 12], indicating UTC+12 to UTC-12. A negative value indicates Eastern Standard Time, and a positive value indicates Western Standard Time. For example, **-8** indicates UTC+8.
For countries or regions crossing the International Date Line, use -13 (UTC+13) and -14 (UTC+14) to ensure consistent time within the entire country or region. If the set value is not within the valid range, the time zone offset of the current system will be used.| +| contorller | [TextClockContorller](#textclockcontroller) | No| null | Binds a controller to control the status of the **** component.| ## Attributes @@ -30,25 +31,24 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type| Default Value | Description | | ------ | -------- | -------- | ------------------------------------------------------------ | -| format | string | 'hhmmss' | Time format, for example, **yyyy/mm/dd** or **yyyy-mm-dd**. Supported time format strings:
  • yyyy (year)
  • mm (two-letter abbreviated month name)
  • mmm (three-letter abbreviated month name)
  • mmmm (full month name)
  • dd (two-letter abbreviated day of the week)
  • ddd (three-letter abbreviated day of the week)
  • dddd (full day of the week)
  • HH (24-hour format)
  • hh (12-hour format)
  • MM/mm (minute)
  • SS/ss (second)
| +| format | string | 'hms' | Time format.
The date separator is a slash (/), and the time separator is a colon (:).
For example, yyyyMMdd and yyyy-MM-dd are displayed as yyyy/MM/dd,
and hhmmss is displayed as hh:mm:ss.
Only one digit is required for the time format. This means that hhmmss is equivalent to hms.
Supported time format strings:
- YYYY/yyyy: four-digit year
- YY/yy: last two digits of year
- M: one-digit month (MM for two-digit month, for example, 01)
- d: one-digit day (dd for two-digit day, for example, 01)
- D: number of days that have elapsed in the year
- H: 24-hour format
- h: 12-hour format
- m: minute
- s: second
- SSS: millisecond| ## Events -In addition to the [universal events](ts-universal-events-click.md), the following attributes are supported. +In addition to the universal events (ts-universal-events-click.md), the following events are supported. | Name | Description | | -------------------------------------------- | ------------------------------------------------------------ | -| onDateChange(event: (value: number) => void) | Triggered when the time changes in seconds at minimum.
**value**: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch. | +| onDateChange(event: (value: number) => void) | Called when the time changes in seconds at minimum.
**value**: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch. | ## TextClockController -Controller of the **** component, which can be bound to the component for status control. +Implements a controller of the **** component, which can be bound to the component for status control. ### Objects to Import ```ts controller: TextClockController = new TextClockController() - ``` ### start @@ -74,27 +74,27 @@ struct Second { controller: TextClockController = new TextClockController() build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) { - Text('Current milliseconds is ' + this.accumulateTime) - .fontSize(20) - // Display the system time in 12-hour format for the UTC+8 time zone, accurate to seconds. - TextClock({timeZoneOffset: -8, controller: this.controller}) - .format('hhmmss') - .onDateChange((value: number) => { - this.accumulateTime = value - }) - .margin(20) - .fontSize(30) - Button("start TextClock") - .margin({ bottom: 10 }) - .onClick(()=>{ - this.controller.start() - }) - Button("stop TextClock") - .onClick(()=>{ - this.controller.stop() - }) - } + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Current milliseconds is ' + this.accumulateTime) + .fontSize(20) + // Display the system time in 12-hour format for the UTC+8 time zone, accurate to seconds. + TextClock({ timeZoneOffset: -8, controller: this.controller }) + .format('hms') + .onDateChange((value: number) => { + this.accumulateTime = value + }) + .margin(20) + .fontSize(30) + Button("start TextClock") + .margin({ bottom: 10 }) + .onClick(() => { + this.controller.start() + }) + Button("stop TextClock") + .onClick(() => { + this.controller.stop() + }) + } .width('100%') .height('100%') } -- GitLab