Does anyone know if it's possible to disable the date/time picker from automatically adding the UTC time to the date object? As you can see in the below picture that it's automatically adjusting my date object to UTC. I want my date object submitted with 10:00:00
{"reportedDate": "2019-02-13T15:00:16.000Z"}
<p-calendar required [(ngModel)]="entry.reportedDate" name="reportedDate" #reportedDate="ngModel" [showIcon]="true" [showTime]="true" dateFormat="mm/dd/y 'EST'" hourFormat="24"></p-calendar>
According to the documentation page for this component (in the properties table):
Name Type Default Description ----------------------------------------------------------------------------- dataType string date Type of the value to write back to ngModel, default is date and alternative is string.
You should pass [dataType]="string"
. This will prevent a Date
object from being constructed, which will in-turn prevent any time zone conversions.
Also, I recommend not putting a time zone abbreviation in the format for the entry. Keep in mind that daylight saving time might be in effect depending on the date chosen, and also that not every time zone has a clear and consistent abbreviation, and that some abbreviations (such as CST or IST) are ambiguous.
If you need to indicate to the user that the entry is in US Eastern Time, then put that somewhere outside of the textbox. If you must use an abbreviation, use ET
as the generic form.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With