apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 989 forks source link

cordova-ios 6.1.1 input type date crashing the app #1070

Closed yuriivanovich closed 1 year ago

yuriivanovich commented 3 years ago

Bug Report

when i click any input type date or type time, it causes the app to crash. i even created a new empty cordova project and added only input type date, to rule out that any plugin is causing the crash, but the same problem happens

What does actually happen?

when you click input type date, the app crash with exeption: reason __NSCFString * "Invalid calculation: number of calculated days is not dividable by the number of days in a week." 0x0000600002cc2e00

on code line 32

/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
//
//  main.m
//  Smart Waters
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//  Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
}

Environment, Platform, Device

iphone 12 pro max simulator running IOS 14.3,

Version information

node -v : 15.7.0 cordova -v: 10.0.0 cordova-ios: 6.1.1 Xcode 12.3

Checklist

timbru31 commented 3 years ago

This sounds like a simulator, iOS or WebKit bug. Can you verify that the same HTML works fine in Safari?

yuriivanovich commented 3 years ago

today i was able to access an iphone from the office (due to lockdown it's hard lately), running ios 14.3, the same behavior happens when you click any input type date or time.

then tried from safari on phone, the same behavior happens. then from mac tried on safari, the input acts like a text input. this isn't a cordova issue more like ios issue?

seems like my option right now is to convert to a jquery datepicker for the time being, we can't afford this, the app has thousands of daily users

barakataboujreich commented 3 years ago

we are having the same issue. our app includes a lot of input type dates to handle access rights and reservations. whenever we click any date input, the app crashes.

iphone X ios 14.3 cordova 10.0.0 cordova ios 6.1.1

dpogue commented 3 years ago

I'm trying to reproduce this in the iOS 14.3 simulator with <input type="date"> and <input type="time"> and I'm not seeing any crashes. Do you have a sample HTML test case you could share?

For the record, I'm 99.9% sure this would be a WebKit bug. I'm trying to reproduce it so that I can file a ticket with Apple that includes all the relevant details.

yuriivanovich commented 3 years ago

the simple cordova create test com.testing.date test command, then adding a <input type="date"> then building cordova build ios then going to xcode launching the app to the simulator, and then clicking the input is freezing the app for couple of seconds, and then crashes with the exception provided. i can share that html file if you want. but our app i'm not authorized to share it

yuriivanovich commented 3 years ago

would building on another mac might solve this ?

dpogue commented 3 years ago

hmm, that sounds almost identical to my test case:

    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>
            <div>
                Time: <input type="time">
            </div>
            <div>
                Date: <input type="date">
            </div>
            <div>
                Date Time: <input type="datetime-local">
            </div>
        </div>
        <script src="cordova.js"></script>
        <script src="js/index.js"></script>
    </body>

I saw no issues in the simulator on iOS 14.3 or 14.4 (iPhone SE 2nd gen)

yuriivanovich commented 3 years ago

so what might be the issue here? is it on my side? what should i try to give more info to try and fix this

yuriivanovich commented 3 years ago

i took some screenshots of what i am doing, maybe this will be able to help. this is my HTML with no plugins installed code

Iphone SE 2nd gen simulator device running

and here is my exception exception

dpogue commented 3 years ago

@yuriivanovich Out of curiosity, are you using a non-Gregorian calendar?

yuriivanovich commented 3 years ago

i don't think so. this is the calendar settings on the mac Untitled

dpogue commented 1 year ago

I've marked this issue as stale because it's been over a year with no further comments. If this is still an issue in the latest cordova-ios version and an up-to-date iOS version, please let us know. Otherwise, this issue will be closed.

dpogue commented 1 year ago

Closing as stale.