File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
import dayjs from "dayjs" ;
2
2
import utc from "dayjs/plugin/utc" ;
3
+
3
4
import timezone from "dayjs/plugin/timezone" ;
5
+ import advanced from "dayjs/plugin/advancedFormat" ;
4
6
5
7
dayjs . extend ( utc ) ;
6
8
dayjs . extend ( timezone ) ;
9
+ dayjs . extend ( advanced ) ;
7
10
8
11
export const IFX_TIMEZONE = "America/New_York" ;
9
- export const dateFormatIfx = "YYYY-MM-DD HH:mm:ss" ;
12
+ export const IFX_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" ;
10
13
11
14
class DateUtil {
12
- public formatDateForIfx ( date : string ) : string | undefined {
15
+ public formatDateForIfx ( date : string , format : string = IFX_DATE_FORMAT ) : string | undefined {
13
16
const parsedDate = dayjs ( date ) ;
14
- return parsedDate . isValid ( )
15
- ? parsedDate . tz ( IFX_TIMEZONE ) . format ( dateFormatIfx )
16
- : undefined ;
17
+ return parsedDate . isValid ( ) ? parsedDate . tz ( IFX_TIMEZONE ) . format ( format ) : undefined ;
17
18
}
18
19
19
20
public isValidDate ( date : string ) {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
23
23
} from "@topcoder-framework/domain-acl" ;
24
24
import { getRequest } from "../api/v5Api" ;
25
25
import m2mToken from "../helpers/MachineToMachineToken" ;
26
+ import DateUtil from "./DateUtil" ;
26
27
27
28
class LegacyMapper {
28
29
// To be used on challenge:update calls that change state from New -> Draft
@@ -243,6 +244,9 @@ class LegacyMapper {
243
244
if ( input . billing ?. billingAccountId != null ) {
244
245
projectInfo [ 32 ] = input . billing ?. billingAccountId ! . toString ( ) ;
245
246
}
247
+ if ( input . status === ChallengeStatuses . Completed ) {
248
+ projectInfo [ 21 ] = DateUtil . formatDateForIfx ( new Date ( ) . toISOString ( ) , "MM.DD.YYYY HH:mm z" ) ! ; // project_info 21 is Completion Timestamp; and it has a different date format
249
+ }
246
250
247
251
const map = {
248
252
...projectInfo ,
You can’t perform that action at this time.
0 commit comments