mirror of https://github.com/zulip/zulip.git
timerender: Fix should_display_profile_incomplete_alert.
new Date requires timestamps in milliseconds.
This commit is contained in:
parent
c9af4d571b
commit
6b5847dbf7
|
@ -536,7 +536,7 @@ export function get_time_limit_setting_in_appropriate_unit(
|
|||
|
||||
export function should_display_profile_incomplete_alert(timestamp: number): boolean {
|
||||
const today = new Date(Date.now());
|
||||
const time = new Date(timestamp);
|
||||
const time = new Date(timestamp * 1000);
|
||||
const days_old = difference_in_calendar_days(today, time, display_time_zone);
|
||||
|
||||
if (days_old >= 15) {
|
||||
|
|
|
@ -631,14 +631,14 @@ run_test("set_full_datetime", () => {
|
|||
|
||||
run_test("should_display_profile_incomplete_alert", () => {
|
||||
// Organization created < 15 days ago
|
||||
let realm_date_created = new Date();
|
||||
realm_date_created.setDate(realm_date_created.getDate() - 5);
|
||||
|
||||
assert.equal(timerender.should_display_profile_incomplete_alert(realm_date_created), false);
|
||||
let realm_date_created_secs = Date.now() / 1000;
|
||||
assert.equal(
|
||||
timerender.should_display_profile_incomplete_alert(realm_date_created_secs),
|
||||
false,
|
||||
);
|
||||
|
||||
// Organization created > 15 days ago
|
||||
realm_date_created = new Date();
|
||||
realm_date_created.setDate(realm_date_created.getDate() - 15);
|
||||
realm_date_created_secs -= 16 * 86400;
|
||||
|
||||
assert.equal(timerender.should_display_profile_incomplete_alert(realm_date_created), true);
|
||||
assert.equal(timerender.should_display_profile_incomplete_alert(realm_date_created_secs), true);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue