Skip to content

Commit

Permalink
feat(MWPW-154981): adds a new Created Date option to details text
Browse files Browse the repository at this point in the history
  • Loading branch information
cmiqueo committed Aug 5, 2024
1 parent fd0e6aa commit 4098688
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.15.2 (8/2/2024, 14:06:05)
* Chimera UI Libraries - Build 0.16.0 (8/5/2024, 09:58:28)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -46698,6 +46698,7 @@ var CardType = {
hideCTA: _propTypes.bool,
startDate: _propTypes.string,
endDate: _propTypes.string,
cardDate: _propTypes.string,
modifiedDate: _propTypes.string,
bannerMap: (0, _propTypes.shape)(Object).isRequired,
tags: (0, _propTypes.arrayOf)((0, _propTypes.shape)(_card.tagsType)),
Expand All @@ -46722,6 +46723,7 @@ var defaultProps = {
hideCTA: false,
startDate: '',
endDate: '',
cardDate: '',
modifiedDate: '',
tags: [],
origin: ''
Expand Down Expand Up @@ -46755,6 +46757,7 @@ var Card = function Card(props) {
isBookmarked = props.isBookmarked,
onClick = props.onClick,
dateFormat = props.dateFormat,
cardDate = props.cardDate,
modifiedDate = props.modifiedDate,
_props$styles = props.styles,
image = _props$styles.backgroundImage,
Expand Down Expand Up @@ -46840,10 +46843,13 @@ var Card = function Card(props) {
* @type {String}
*/
var detailText = prettyDate || label;
if (modifiedDate && detailsTextOption === 'modifiedDate') {
if (detailsTextOption === 'modifiedDate' && modifiedDate) {
var localModifiedDate = new Date(modifiedDate);
// detailText = lastModified.replace('{date}', localModifiedDate.toLocaleDateString());
detailText = lastModified && lastModified.replace('{date}', localModifiedDate.toLocaleDateString()) || localModifiedDate.toLocaleDateString();
} else if (detailsTextOption === 'createdDate' && cardDate) {
console.log('cardDate', cardDate);
var localCreatedDate = new Date(cardDate);
detailText = localCreatedDate.toLocaleDateString();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions dist/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/main.source.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions react/src/js/components/Consonant/Cards/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const CardType = {
hideCTA: bool,
startDate: string,
endDate: string,
cardDate: string,
modifiedDate: string,
bannerMap: shape(Object).isRequired,
tags: arrayOf(shape(tagsType)),
Expand All @@ -68,6 +69,7 @@ const defaultProps = {
hideCTA: false,
startDate: '',
endDate: '',
cardDate: '',
modifiedDate: '',
tags: [],
origin: '',
Expand Down Expand Up @@ -102,6 +104,7 @@ const Card = (props) => {
isBookmarked,
onClick,
dateFormat,
cardDate,
modifiedDate,
styles: {
backgroundImage: image,
Expand Down Expand Up @@ -197,12 +200,15 @@ const Card = (props) => {
* @type {String}
*/
let detailText = prettyDate || label;
if (modifiedDate && detailsTextOption === 'modifiedDate') {
if (detailsTextOption === 'modifiedDate' && modifiedDate) {
const localModifiedDate = new Date(modifiedDate);
// detailText = lastModified.replace('{date}', localModifiedDate.toLocaleDateString());
detailText = lastModified
&& lastModified.replace('{date}', localModifiedDate.toLocaleDateString())
|| localModifiedDate.toLocaleDateString();
} else if (detailsTextOption === 'createdDate' && cardDate) {
console.log('cardDate', cardDate);
const localCreatedDate = new Date(cardDate);
detailText = localCreatedDate.toLocaleDateString();
}

/**
Expand Down

0 comments on commit 4098688

Please sign in to comment.