Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: replace moment with dayjs #6980

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: format code
  • Loading branch information
martinjagodic committed Nov 17, 2023
commit 8fc3d969528d9f3ea49079dc53949347565b461d
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ class WorkflowList extends React.Component {
return (
<div>
{entries.map(entry => {
const timestamp = dayjs(entry.get('updatedOn')).format(
t('workflow.workflow.dateFormat'),
);
const timestamp = dayjs(entry.get('updatedOn')).format(t('workflow.workflow.dateFormat'));
const slug = entry.get('slug');
const collectionName = entry.get('collection');
const editLink = `collections/${collectionName}/entries/${slug}?ref=workflow`;
Expand Down
8 changes: 4 additions & 4 deletions packages/decap-cms-widget-datetime/src/DateTimeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ export default class DateTimeControl extends React.Component {

// Date is valid if datetime is a dayjs or Date object otherwise it's a string.
// Handle the empty case, if the user wants to empty the field.
isValidDate = datetime =>
dayjs.isDayjs(datetime) || datetime instanceof Date || datetime === '';
isValidDate = datetime => dayjs.isDayjs(datetime) || datetime instanceof Date || datetime === '';

handleChange = datetime => {
/**
Expand All @@ -100,7 +99,8 @@ export default class DateTimeControl extends React.Component {
};

render() {
const { forID, value, classNameWrapper, setActiveStyle, setInactiveStyle, t, isDisabled } = this.props;
const { forID, value, classNameWrapper, setActiveStyle, setInactiveStyle, t, isDisabled } =
this.props;

return (
<div
Expand All @@ -112,7 +112,7 @@ export default class DateTimeControl extends React.Component {
id={forID}
className={classNameWrapper}
type="datetime-local"
value={dayjs(value).format("YYYY-MM-DDThh:mm")}
value={dayjs(value).format('YYYY-MM-DDThh:mm')}
onChange={e => this.handleChange(dayjs(e.target.value))}
onFocus={setActiveStyle}
onBlur={setInactiveStyle}
Expand Down
6 changes: 5 additions & 1 deletion website/src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function Layout({ hasPageHero, children }) {
>
<Helmet defaultTitle={title} titleTemplate={`%s | ${title}`}>
<meta name="description" content={description} />
<meta name="image" property="og:image" content="https://decapcms.org/img/og-image.jpg" />
<meta
name="image"
property="og:image"
content="https://decapcms.org/img/og-image.jpg"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,700,900|Roboto+Mono:400,700"
Expand Down