Skip to content

Commit 4056291

Browse files
authored
Merge pull request #57 from autifyhq/hiroki/fix-date-string
Call the toJSON method before returning the Date object.
2 parents 9e434f4 + ea6a695 commit 4056291

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Diff for: content/en/snippets/values/get_current_date.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: "Get current timestamp considering timezone"
2+
title: "Get date and time string"
33
weight: 70
44
ie_support: true
55
---
66

7-
Generate a timestamp that depends on the locale on execution environment.
7+
Returns the date and time as a string in ISO format (e.g., 2024-06-19T12:34:56.789Z) according to the environment in which the test was run.
88

99
Since the Autify test run cannot be certain of which time zone the server is in, you need to calculate the offset.
1010

@@ -17,5 +17,5 @@ var to_timezone = 0; /* TODO: REPLACE THE NUMBER */
1717
var from_timezone_offset = new Date().getTimezoneOffset() * 60 * 1000;
1818
var to_timezone_offset = to_timezone * 60 * 60 * 1000;
1919
var date = new Date(Date.now() + from_timezone_offset + to_timezone_offset);
20-
return date;
20+
return date.toJSON();
2121
```

Diff for: content/ja/snippets/others/search_in_table_and_operate_specific_column.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ if(!targetElement) {
4141
* click() メソッドを使う、アサーションを行う、そのまま要素を返す、等。
4242
*/
4343
targetElement.click();
44-
```
44+
```

Diff for: content/ja/snippets/values/get_current_date.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: "日付を取得する"
2+
title: "日時文字列を取得する"
33
weight: 70
44
ie_support: true
55
---
66

7-
テスト実行時の環境に合わせたタイムスタンプを作成するために使います
7+
テスト実行時の環境に合わせた日時をISO形式(例:2024-06-19T12:34:56.789Z)の文字列として返します
88

99
Autify のテスト実行ではどのタイムゾーンのサーバーか確約ができないため、オフセットを計算する必要があります。
1010

@@ -17,5 +17,5 @@ var to_timezone = 0; /* TODO: REPLACE THE NUMBER */
1717
var from_timezone_offset = new Date().getTimezoneOffset() * 60 * 1000;
1818
var to_timezone_offset = to_timezone * 60 * 60 * 1000;
1919
var date = new Date(Date.now() + from_timezone_offset + to_timezone_offset);
20-
return date;
20+
return date.toJSON();
2121
```

0 commit comments

Comments
 (0)