[questions][fix] use UTC time for month and year

pull/531/head
Jeff Sieu 2 years ago
parent d54586fbfe
commit f400af76af

@ -151,7 +151,9 @@ export default function ContributeQuestionForm({
}}
yearRequired={true}
onChange={({ month, year }) => {
field.onChange(startOfMonth(new Date(year!, month! - 1)));
field.onChange(
new Date(Date.UTC(year!, month! - 1, 1, 0, 0, 0, 0)),
);
}}
/>
)}
@ -266,18 +268,13 @@ export default function ContributeQuestionForm({
/>
</div>
<div className="flex gap-x-2">
<button
className="focus:ring-primary-500 inline-flex w-full justify-center rounded-md border border-slate-300 bg-white px-4 py-2 text-base font-medium text-slate-700 shadow-sm hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-offset-2 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
type="button"
onClick={onDiscard}>
Discard
</button>
<Button label="Discard" variant="tertiary" onClick={onDiscard} />
<Button
className="bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 inline-flex w-full justify-center rounded-md border border-transparent px-4 py-2 text-base font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:bg-slate-400 sm:ml-3 sm:w-auto sm:text-sm"
disabled={!checkedSimilar}
label="Contribute"
type="submit"
variant="primary"></Button>
variant="primary"
/>
</div>
</div>
</form>

@ -130,7 +130,7 @@ export default function CreateQuestionEncounterForm({
yearLabel=""
onChange={(value) => {
setSelectedDate(
startOfMonth(new Date(value.year!, value.month! - 1)),
new Date(Date.UTC(value.year!, value.month! - 1, 1, 0, 0, 0, 0)),
);
}}
/>

Loading…
Cancel
Save