rez_core 4.0.80 → 4.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "4.0.80",
3
+ "version": "4.0.81",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,9 +1,9 @@
1
1
  import { DataSource } from 'typeorm';
2
2
  import { Inject, Injectable } from '@nestjs/common';
3
3
  import { UserData } from '../../user/entity/user.entity';
4
+ import * as moment from 'moment';
4
5
  import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
5
6
  import { ModuleRef } from '@nestjs/core';
6
- import moment from 'moment-timezone';
7
7
 
8
8
  @Injectable()
9
9
  export class ResolverService {
@@ -91,14 +91,12 @@ export class ResolverService {
91
91
  attr.element_type === 'date' ||
92
92
  attr.element_type === 'datetime'
93
93
  ) {
94
- // Interpret DB value as UTC, then convert to IST
95
- const dateValue = moment.utc(codeValue).tz('Asia/Kolkata');
96
-
94
+ const dateValue = moment(codeValue).utcOffset('+05:30'); // IST
97
95
  if (dateValue.isValid()) {
98
96
  resolvedEntityData[field] =
99
97
  attr.element_type === 'date'
100
- ? dateValue.format('DD-MMM-YYYY')
101
- : dateValue.format('YYYY-MM-DD HH:mm:ss');
98
+ ? dateValue.format('DD-MM-YYYY')
99
+ : dateValue.format('DD-MM-YYYY HH:mm:ss');
102
100
  }
103
101
  }
104
102
 
@@ -74,6 +74,10 @@ export class ActionDataRepository extends EntityServiceImpl {
74
74
  loggedInUser,
75
75
  );
76
76
 
77
+ const now = new Date();
78
+ const istOffset = 5.5 * 60; // IST is UTC +5:30 in minutes
79
+ const istDate = new Date(now.getTime() + istOffset * 60 * 1000);
80
+
77
81
  const data = {
78
82
  entity_type: 'LFRM',
79
83
  name: viewMaster?.name,
@@ -84,6 +88,7 @@ export class ActionDataRepository extends EntityServiceImpl {
84
88
  form_url: dynamicFormURL,
85
89
  status: FORM_STATUS_TO_BE_SENT,
86
90
  action_id: act.id,
91
+ created_date: istDate,
87
92
  };
88
93
 
89
94
  const createdEntity = await super.createEntity(
@@ -51,15 +51,25 @@ export class TaskRepository {
51
51
  );
52
52
 
53
53
  const now = new Date();
54
-
55
- const dueDateTime = new Date(now.setDate(now.getDate() + 2));
56
-
57
- const due_date = dueDateTime.toISOString().split('T')[0];
58
- const due_time = dueDateTime.toLocaleTimeString('en-US', {
59
- hour12: true,
60
- hour: '2-digit',
61
- minute: '2-digit',
54
+ const dueDateTime = new Date(now);
55
+ dueDateTime.setDate(dueDateTime.getDate() + 2);
56
+
57
+ // Force conversion to IST
58
+ const istFormatterDate = new Intl.DateTimeFormat('en-CA', {
59
+ timeZone: 'Asia/Kolkata'
60
+ });
61
+ const istFormatterTime = new Intl.DateTimeFormat('en-US', {
62
+ timeZone: 'Asia/Kolkata',
63
+ hour: '2-digit',
64
+ minute: '2-digit',
65
+ hour12: true
62
66
  });
67
+
68
+ const due_date = istFormatterDate.format(dueDateTime); // YYYY-MM-DD in IST
69
+ const due_time = istFormatterTime.format(dueDateTime); // e.g. "03:14 AM"
70
+
71
+ console.log({ due_date, due_time });
72
+
63
73
 
64
74
  const taskData = this.TaskRepository.create({
65
75
  stage_id: act.stage_id,