1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Set text field value as a string when it's for a date or a time (bug 1868503)

This commit is contained in:
Calixte Denizet 2023-12-06 09:44:30 +01:00
parent c0436013a0
commit 098cc16c46
3 changed files with 78 additions and 3 deletions

View file

@ -49,7 +49,7 @@ function getFieldType(actions) {
if (format.startsWith("AFDate_")) {
return FieldType.date;
}
if (format.startsWith("AFTime__")) {
if (format.startsWith("AFTime_")) {
return FieldType.time;
}
return FieldType.none;

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { createActionsMap, getFieldType } from "./common.js";
import { createActionsMap, FieldType, getFieldType } from "./common.js";
import { Color } from "./color.js";
import { PDFObject } from "./pdf_object.js";
@ -245,7 +245,12 @@ class Field extends PDFObject {
return;
}
if (value === "" || typeof value !== "string") {
if (
value === "" ||
typeof value !== "string" ||
// When the field type is date or time, the value must be a string.
this._fieldType >= FieldType.date
) {
this._originalValue = undefined;
this._value = value;
return;