fix: manually-freshened-at date overwritten
This commit is contained in:
parent
b079001cc5
commit
5866c94535
4 changed files with 47 additions and 21 deletions
|
|
@ -220,12 +220,16 @@ mod get {
|
|||
.await?;
|
||||
|
||||
let cid_url = format!("/contact/{}", contact.id);
|
||||
let mfresh_str = contact
|
||||
let mfresh_on_str = contact
|
||||
.manually_freshened_at
|
||||
.clone()
|
||||
.map_or("".to_string(), |m| {
|
||||
m.to_zoned(TimeZone::UTC).date().to_string()
|
||||
});
|
||||
let mfresh_at_str = contact
|
||||
.manually_freshened_at
|
||||
.clone()
|
||||
.map_or("".to_string(), |m| m.to_zoned(TimeZone::UTC).to_string());
|
||||
|
||||
let text_body: String =
|
||||
sqlx::query!("select text_body from contacts where id = $1", contact_id)
|
||||
|
|
@ -261,17 +265,17 @@ mod get {
|
|||
input type="button" value="Add" x-on:click="names.push(new_name); new_name = ''";
|
||||
}
|
||||
}
|
||||
label { "status" }
|
||||
label for="status" { "status" }
|
||||
div {
|
||||
select name="status" x-model=("status") {
|
||||
select #status name="status" x-model=("status") {
|
||||
option value="normal" { "Normal" }
|
||||
option value="permanent" { "Cannot go stale" }
|
||||
option value="inactive" { "Inactive" }
|
||||
}
|
||||
}
|
||||
label x-show="status === 'normal'" { "minimum stale time" }
|
||||
label x-show="status === 'normal'" for="periodicity" { "minimum stale time" }
|
||||
div x-show="status === 'normal'"{
|
||||
input name="periodicity" value=(format!("{:#}", contact.periodicity));
|
||||
input name="periodicity" id="periodicity" value=(format!("{:#}", contact.periodicity));
|
||||
span .hint { code { "[0-9]+ (yr|mo|wk|day|h|m|s)" } "(" a href="https://docs.rs/jiff/latest/jiff/struct.Span.html#parsing-and-printing" { "details" } ")" }
|
||||
}
|
||||
label { "birthday" }
|
||||
|
|
@ -279,8 +283,8 @@ mod get {
|
|||
input name="birthday" value=(contact.birthday.clone().map_or("".to_string(), |b| b.serialize()));
|
||||
span .hint { code { "(yyyy|--)mmdd" } " or free text" }
|
||||
}
|
||||
label { "freshened" }
|
||||
div x-data=(json!({ "date": mfresh_str, "stamp": "" })) x-init="today = () => (new Date().toISOString().split('T')[0])" {
|
||||
label for="manually_freshened_on" { "freshened" }
|
||||
div x-data=(json!({ "date": mfresh_on_str, "stamp": mfresh_at_str })) x-init="today = () => (new Date().toISOString().split('T')[0])" {
|
||||
input
|
||||
type="hidden"
|
||||
name="manually_freshened_at"
|
||||
|
|
@ -288,6 +292,7 @@ mod get {
|
|||
input
|
||||
type="date"
|
||||
name="manually_freshened_on"
|
||||
id="manually_freshened_on"
|
||||
x-model="date"
|
||||
x-bind:max="today()"
|
||||
x-on:input="stamp = new Date(date).toISOString()";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue