@@ -7,18 +7,18 @@ import jsonic from "jsonic";
77import { DebounceInput } from "react-debounce-input" ;
88import { useIntl } from "react-intl" ;
99
10- import { labels } from "@cocalc/frontend/i18n" ;
1110import { Projects } from "@cocalc/frontend/admin/users/projects" ;
1211import { Button , Checkbox } from "@cocalc/frontend/antd-bootstrap" ;
1312import { CSS , Rendered , TypedMap } from "@cocalc/frontend/app-framework" ;
1413import {
1514 A ,
1615 CopyToClipBoard ,
1716 DateTimePicker ,
18- Icon ,
1917 Gap ,
18+ Icon ,
2019 TimeAgo ,
2120} from "@cocalc/frontend/components" ;
21+ import { labels } from "@cocalc/frontend/i18n" ;
2222import {
2323 capitalize ,
2424 days_ago ,
@@ -35,7 +35,7 @@ import { actions } from "./actions";
3535import { Managers } from "./managers" ;
3636import Owner from "./owner" ;
3737import { DisplayQuota , EditQuota } from "./quota" ;
38- import { license_fields , license_field_type , ManagerInfo } from "./types" ;
38+ import { license_field_type , license_fields , ManagerInfo } from "./types" ;
3939import {
4040 DisplayUpgrades ,
4141 EditUpgrades ,
@@ -142,6 +142,12 @@ export const License: React.FC<Props> = (props: Props) => {
142142 actions . set_edit ( license . get ( "id" ) , field , new_val ) ;
143143 }
144144
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+
145151 function render_value_editing (
146152 type : license_field_type ,
147153 field ,
@@ -190,7 +196,9 @@ export const License: React.FC<Props> = (props: Props) => {
190196 x = (
191197 < DateTimePicker
192198 value = { val }
193- onChange = { onChange }
199+ onChange = { ( date , dateString ) =>
200+ on_date_change ( field , date , dateString )
201+ }
194202 style = { { width : "100%" , maxWidth : "40ex" } }
195203 />
196204 ) ;
@@ -517,7 +525,7 @@ export const License: React.FC<Props> = (props: Props) => {
517525 return (
518526 < >
519527 < Button onClick = { ( ) => actions . cancel_editing ( id ) } disabled = { saving } >
520- { intl . formatMessage ( labels . cancel ) }
528+ { intl . formatMessage ( labels . cancel ) }
521529 </ Button >
522530 < Gap />
523531 < Button
@@ -577,7 +585,7 @@ export const License: React.FC<Props> = (props: Props) => {
577585
578586 // Show a message explaining whether -- with the current saved settings --
579587 // 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.
581589 function render_status ( ) : Rendered {
582590 if ( editing ) {
583591 return (
0 commit comments