@@ -7,18 +7,18 @@ import jsonic from "jsonic";
7
7
import { DebounceInput } from "react-debounce-input" ;
8
8
import { useIntl } from "react-intl" ;
9
9
10
- import { labels } from "@cocalc/frontend/i18n" ;
11
10
import { Projects } from "@cocalc/frontend/admin/users/projects" ;
12
11
import { Button , Checkbox } from "@cocalc/frontend/antd-bootstrap" ;
13
12
import { CSS , Rendered , TypedMap } from "@cocalc/frontend/app-framework" ;
14
13
import {
15
14
A ,
16
15
CopyToClipBoard ,
17
16
DateTimePicker ,
18
- Icon ,
19
17
Gap ,
18
+ Icon ,
20
19
TimeAgo ,
21
20
} from "@cocalc/frontend/components" ;
21
+ import { labels } from "@cocalc/frontend/i18n" ;
22
22
import {
23
23
capitalize ,
24
24
days_ago ,
@@ -35,7 +35,7 @@ import { actions } from "./actions";
35
35
import { Managers } from "./managers" ;
36
36
import Owner from "./owner" ;
37
37
import { DisplayQuota , EditQuota } from "./quota" ;
38
- import { license_fields , license_field_type , ManagerInfo } from "./types" ;
38
+ import { license_field_type , license_fields , ManagerInfo } from "./types" ;
39
39
import {
40
40
DisplayUpgrades ,
41
41
EditUpgrades ,
@@ -142,6 +142,12 @@ export const License: React.FC<Props> = (props: Props) => {
142
142
actions . set_edit ( license . get ( "id" ) , field , new_val ) ;
143
143
}
144
144
145
+ function on_date_change ( field , _date , dateString ) : void {
146
+ // For date fields, use the dateString instead of the Day.js object
147
+ // to ensure proper serialization for PostgreSQL
148
+ actions . set_edit ( license . get ( "id" ) , field , dateString || null ) ;
149
+ }
150
+
145
151
function render_value_editing (
146
152
type : license_field_type ,
147
153
field ,
@@ -190,7 +196,9 @@ export const License: React.FC<Props> = (props: Props) => {
190
196
x = (
191
197
< DateTimePicker
192
198
value = { val }
193
- onChange = { onChange }
199
+ onChange = { ( date , dateString ) =>
200
+ on_date_change ( field , date , dateString )
201
+ }
194
202
style = { { width : "100%" , maxWidth : "40ex" } }
195
203
/>
196
204
) ;
@@ -517,7 +525,7 @@ export const License: React.FC<Props> = (props: Props) => {
517
525
return (
518
526
< >
519
527
< Button onClick = { ( ) => actions . cancel_editing ( id ) } disabled = { saving } >
520
- { intl . formatMessage ( labels . cancel ) }
528
+ { intl . formatMessage ( labels . cancel ) }
521
529
</ Button >
522
530
< Gap />
523
531
< Button
@@ -577,7 +585,7 @@ export const License: React.FC<Props> = (props: Props) => {
577
585
578
586
// Show a message explaining whether -- with the current saved settings --
579
587
// this license will upgrade any projects. Only shown in view mode, to
580
- // avoid potentional confusion in edit mode.
588
+ // avoid potential confusion in edit mode.
581
589
function render_status ( ) : Rendered {
582
590
if ( editing ) {
583
591
return (
0 commit comments