Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/prefer-date-now.
Anders Kaseorgdd8e14d3e6c6
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.jsindex 7429e71c06f..49e0c92ff0a 100644--- a/frontend_tests/node_tests/drafts.js+++ b/frontend_tests/node_tests/drafts.js@@ -54,7 +54,7 @@ function stub_timestamp(timestamp, func) {function fake_time() {return timestamp;}- with_field(Date.prototype, "getTime", fake_time, func);+ with_field(Date, "now", fake_time, func);}const legacy_draft = {diff --git a/static/js/debug.js b/static/js/debug.jsindex 086a94af9a3..94b7b8bcc18 100644--- a/static/js/debug.js+++ b/static/js/debug.js@@ -11,9 +11,9 @@to the console along with the name "foo". */export function print_elapsed_time(name, fun) {- const t0 = new Date().getTime();+ const t0 = Date.now();const out = fun();- const t1 = new Date().getTime();+ const t1 = Date.now();console.log(name + ": " + (t1 - t0) + " ms");return out;}diff --git a/static/js/drafts.js b/static/js/drafts.jsindex 1cffbabbd7b..9b1ac597216 100644--- a/static/js/drafts.js+++ b/static/js/drafts.js@@ -23,7 +23,7 @@ const draft_model = (function () {ls.version = 1;function getTimestamp() {- return new Date().getTime();+ return Date.now();}function get() {diff --git a/static/js/feedback_widget.js b/static/js/feedback_widget.jsindex 7527138013d..7601939d227 100644--- a/static/js/feedback_widget.js+++ b/static/js/feedback_widget.js@@ -33,7 +33,7 @@ const animate = {return;}- if (meta.hide_me_time < new Date().getTime() && !meta.alert_hover_state) {+ if (meta.hide_me_time < Date.now() && !meta.alert_hover_state) {animate.fadeOut();return;}@@ -89,7 +89,7 @@ function set_up_handlers() {meta.alert_hover_state = false;// add at least 2000ms but if more than that exists just keep the// current amount.- meta.hide_me_time = Math.max(meta.hide_me_time, new Date().getTime() + 2000);+ meta.hide_me_time = Math.max(meta.hide_me_time, Date.now() + 2000);});meta.$container.on("click", ".exit-me", () => {@@ -128,7 +128,7 @@ exports.show = function (opts) {meta.undo = opts.on_undo;// add a four second delay before closing up.- meta.hide_me_time = new Date().getTime() + 4000;+ meta.hide_me_time = Date.now() + 4000;meta.$container.find(".feedback_title").text(opts.title_text);meta.$container.find(".feedback_undo").text(opts.undo_button_text);diff --git a/static/js/localstorage.js b/static/js/localstorage.jsindex 188d5b53505..c2462b74a45 100644--- a/static/js/localstorage.js+++ b/static/js/localstorage.js@@ -26,7 +26,7 @@ const ls = {return {data,__valid: true,- expires: new Date().getTime() + expires,+ expires: Date.now() + expires,};},diff --git a/static/js/message_edit.js b/static/js/message_edit.jsindex 23fd915e8ce..494a6b99776 100644--- a/static/js/message_edit.js+++ b/static/js/message_edit.js@@ -758,7 +758,7 @@ exports.save_message_row_edit = function (row) {// Settings these attributes causes a "SAVING" notice to// briefly appear where "EDITED" would normally appear until// the message is acknowledged by the server.- message.local_edit_timestamp = Math.round(new Date().getTime() / 1000);+ message.local_edit_timestamp = Math.round(Date.now() / 1000);echo.edit_locally(message, currently_echoing_messages.get(message_id));diff --git a/static/js/muting_ui.js b/static/js/muting_ui.jsindex d79362f3a00..52f2b2c615f 100644--- a/static/js/muting_ui.js+++ b/static/js/muting_ui.js@@ -4,7 +4,7 @@ const render_muted_topic_ui_row = require("../templates/muted_topic_ui_row.hbs")const render_topic_muted = require("../templates/topic_muted.hbs");function timestamp_ms() {- return new Date().getTime();+ return Date.now();}let last_topic_update = 0;diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 874c048f736..07b5b1a700c 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -1260,7 +1260,7 @@ exports.register_click_handlers = function () {return;}- const date = new Date().getTime();+ const date = Date.now();// only run `popovers.hide_all()` if the last scroll was more// than 250ms ago.diff --git a/static/js/setup.js b/static/js/setup.jsindex fdc9884daf8..218b28c6bca 100644--- a/static/js/setup.js+++ b/static/js/setup.js@@ -15,7 +15,7 @@ $(() => {page_params.needs_tutorial = false;}- page_params.page_load_time = new Date().getTime();+ page_params.page_load_time = Date.now();// Display loading indicator. This disappears after the first// get_events completes.diff --git a/static/js/typing.js b/static/js/typing.jsindex d7e7bc35d94..830442dc8b2 100644--- a/static/js/typing.js+++ b/static/js/typing.js@@ -43,7 +43,7 @@ function is_valid_conversation() {}function get_current_time() {- return new Date().getTime();+ return Date.now();}function notify_server_start(user_ids_array) {