Skip to content

Call the toJSON method before returning the Date object. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions content/en/snippets/values/get_current_date.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "Get current timestamp considering timezone"
title: "Get date and time string"
weight: 70
ie_support: true
---

Generate a timestamp that depends on the locale on execution environment.
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.

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

Expand All @@ -17,5 +17,5 @@ var to_timezone = 0; /* TODO: REPLACE THE NUMBER */
var from_timezone_offset = new Date().getTimezoneOffset() * 60 * 1000;
var to_timezone_offset = to_timezone * 60 * 60 * 1000;
var date = new Date(Date.now() + from_timezone_offset + to_timezone_offset);
return date;
return date.toJSON();
```
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ if(!targetElement) {
* click() メソッドを使う、アサーションを行う、そのまま要素を返す、等。
*/
targetElement.click();
```
```
6 changes: 3 additions & 3 deletions content/ja/snippets/values/get_current_date.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "日付を取得する"
title: "日時文字列を取得する"
weight: 70
ie_support: true
---

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

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

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