diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx
index 494530f56d1..0f12e76ff95 100644
--- a/core/src/components/datetime/datetime.tsx
+++ b/core/src/components/datetime/datetime.tsx
@@ -424,10 +424,10 @@ export class Datetime implements ComponentInterface {
* the date that is currently selected, otherwise
* there can be 1 hr difference when dealing w/ DST
*/
- const date = new Date(convertDataToISO(this.workingParts));
- this.workingParts.tzOffset = date.getTimezoneOffset() * -1;
+ const date = new Date(convertDataToISO(this.activeParts));
+ this.activeParts.tzOffset = date.getTimezoneOffset() * -1;
- this.value = convertDataToISO(this.workingParts);
+ this.value = convertDataToISO(this.activeParts);
if (closeOverlay) {
this.closeParentOverlay();
diff --git a/core/src/components/datetime/test/basic/e2e.ts b/core/src/components/datetime/test/basic/e2e.ts
index a6ef616cf84..754ece63e48 100644
--- a/core/src/components/datetime/test/basic/e2e.ts
+++ b/core/src/components/datetime/test/basic/e2e.ts
@@ -110,3 +110,41 @@ test('datetime:rtl: basic', async () => {
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
});
+
+
+describe('datetime: confirm date', () => {
+
+ test('should set the date value based on the selected date', async () => {
+
+ const page = await newE2EPage({
+ html: `
+
+
+
+ `
+ });
+
+ const eventButton = await page.find('button');
+ await eventButton.click();
+
+ const buttons = await page.findAll('ion-datetime >>> .calendar-next-prev ion-button');
+
+ await buttons[1].click();
+
+ await page.waitForEvent('datetimeMonthDidChange');
+
+ await page.$eval('ion-datetime', async (el: any) => {
+ await el.confirm();
+ });
+
+ const value = await (await page.find('ion-datetime')).getProperty('value');
+
+ expect(value).toMatch('2021-12-25T12:40:00');
+ });
+
+});