@sd-angular/core 1.0.59 → 1.0.60

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.
@@ -1554,18 +1554,30 @@ class SdGridMaterial {
1554
1554
  }
1555
1555
  }
1556
1556
  else if (column.type === 'date') {
1557
+ let date = item[column.field];
1558
+ const { transformDate } = column;
1559
+ if (transformDate) {
1560
+ date = transformDate(date, item);
1561
+ }
1557
1562
  // Nếu là date thì convert theo đúng format
1558
- const date = new Date(item[column.field]);
1559
1563
  obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
1560
1564
  }
1561
1565
  else if (column.type === 'datetime') {
1566
+ let date = item[column.field];
1567
+ const { transformDate } = column;
1568
+ if (transformDate) {
1569
+ date = transformDate(date, item);
1570
+ }
1562
1571
  // Nếu là datetime thì convert theo đúng format
1563
- const date = new Date(item[column.field]);
1564
1572
  obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm:ss');
1565
1573
  }
1566
1574
  else if (column.type === 'time') {
1575
+ let date = item[column.field];
1576
+ const { transformDate } = column;
1577
+ if (transformDate) {
1578
+ date = transformDate(date, item);
1579
+ }
1567
1580
  // Nếu là time thì convert theo đúng format
1568
- const date = new Date(item[column.field]);
1569
1581
  obj[column.field] = Date.toFormat(date, 'HH:mm:ss');
1570
1582
  }
1571
1583
  else if (column.type === 'values') {
@@ -3186,6 +3198,12 @@ class SdCellViewPipe {
3186
3198
  result.display.html = htmlTemplate(value, rowData, __classPrivateFieldGet(this, _isMobileOrTablet$1));
3187
3199
  }
3188
3200
  else {
3201
+ if (column.type === 'datetime' || column.type === 'date' || column.type === 'time') {
3202
+ const { transformDate } = column;
3203
+ if (transformDate) {
3204
+ value = transformDate(value, rowData);
3205
+ }
3206
+ }
3189
3207
  if (typeof (transform) === 'function') {
3190
3208
  const val = transform(value, rowData);
3191
3209
  if (val instanceof Promise) {
@@ -3194,10 +3212,6 @@ class SdCellViewPipe {
3194
3212
  else {
3195
3213
  result.display.value = val;
3196
3214
  }
3197
- if (column.type === 'datetime' && result.display.value) {
3198
- result.display.hasHtml = true;
3199
- result.display.html = `<span class="d-block T14R text-black400">${Date.toFormat(result.display.value, 'HH:mm')}</span><span class="d-block T14R">${Date.toFormat(result.display.value, 'dd/MM/yyyy')}</span>`;
3200
- }
3201
3215
  }
3202
3216
  else {
3203
3217
  if (column.type === 'date' || column.type === 'datetime') {