Skip to content

Instantly share code, notes, and snippets.

@pjchender
Created April 10, 2019 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjchender/15ff90b9205956b6220d5e42c93856da to your computer and use it in GitHub Desktop.
Save pjchender/15ff90b9205956b6220d5e42c93856da to your computer and use it in GitHub Desktop.
diff --git a/src/components/AdminQuotationForm.js b/src/components/AdminQuotationForm.js
index 3c3e836..3943673 100644
--- a/src/components/AdminQuotationForm.js
+++ b/src/components/AdminQuotationForm.js
@@ -269,18 +269,21 @@ class AdminQuotationForm extends React.Component {
}
const {
- quoteExpireAt, quoteStartAt, items, explanations, ...rest
+ quoteExpireAt, quoteStartAt, items, explanations, timezone, ...rest
} = values;
+ const quoteStartAtString = quoteStartAt.format('YYYY-MM-DD HH:mm');
+ const quoteExpireAtString = quoteExpireAt.format('YYYY-MM-DD HH:mm');
handleSubmit({
...rest,
+ timezone,
items: items.map(item => ({
...item,
specialPrice: Number.isInteger(item.specialPrice) ? item.specialPrice : -1,
})).filter(item => item),
explanations: explanations.filter(explanation => explanation),
- quoteStartAt: quoteStartAt.unix(),
- quoteExpireAt: quoteExpireAt.unix(),
+ quoteStartAt: moment.tz(quoteStartAtString, timezone).unix(),
+ quoteExpireAt: moment.tz(quoteExpireAtString, timezone).unix(),
});
});
}
@@ -358,7 +361,9 @@ class AdminQuotationForm extends React.Component {
<Col span={17}>
<StyledFormItem>
{getFieldDecorator('quoteStartAt', {
- initialValue: quoteStartAt ? moment.unix(quoteStartAt) : nowMoment,
+ initialValue: quoteStartAt
+ ? moment.tz(quoteStartAt * 1000, timezone)
+ : nowMoment,
rules: [{ required: true, message: 'Please select quote date' }],
})(<DatePicker format={dateTimeFormat} showTime />)}
</StyledFormItem>
@@ -396,7 +401,9 @@ class AdminQuotationForm extends React.Component {
<Col span={17}>
<StyledFormItem>
{getFieldDecorator('quoteExpireAt', {
- initialValue: quoteExpireAt ? moment.unix(quoteExpireAt) : nowMoment,
+ initialValue: quoteExpireAt
+ ? moment.tz(quoteExpireAt * 1000, timezone)
+ : nowMoment,
rules: [{ required: true, message: 'Please select quote expiration date' }],
})(<DatePicker format={dateTimeFormat} showTime />)}
</StyledFormItem>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment