Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialValue cannot parse time correctly #172

Closed
rziw opened this issue Oct 29, 2017 · 4 comments
Closed

initialValue cannot parse time correctly #172

rziw opened this issue Oct 29, 2017 · 4 comments
Labels

Comments

@rziw
Copy link

rziw commented Oct 29, 2017

سلام
در فرم ایجاد چنانچه اینپوت دیت تایم پیکر خالی باشد بطور صحیح تاریخ و ساعت را برای انتخاب نمایش میدهد اما در فرم ویرایش که اینپوت مقدار دارد تاریخ نمایش داده برای انتخاب نیز اشتباه نمایش داده میشود (سال ۷۷5 و ماه و روز نامرتبتی برای انتخاب نمایش داده میشود)
طبق عکس در لینک زیر
https://screenshots.firefox.com/7GcvWkMbAANrrmEf/instabot.dev
آیا امکانش هست که درصورت پر بودن این اینپوت نیز تاریخ کنونی و یا همان تاریخی که پر شده نمایش داده شود؟
نحوه ی init کردن هم طبق کد زیر :

$('#datepicker1').pDatepicker({ initialValue: false, format: 'YYYY/MM/DD HH:mm:ss', autocomplete :'off', autoClose: true, minDate: new persianDate().valueOf(), timePicker: { enabled: true, meridiem: { enabled: true } } });

@ShariatPanah
Copy link

ShariatPanah commented Nov 1, 2017

@rziw
با سلام، منم همین مشکل رو داشتم، ولی انگار توی نسخه جدید این مورد برطرف شده. این نمونه رو نگاه بندازین
example
باتوجه به مقداری که از سمت سرور برای فیلد تاریخ میاد (میلادی یا شمسی) فیلد
initialValueType
رو مقداردهی کنین

@rziw
Copy link
Author

rziw commented Nov 3, 2017

@ShariatPanah
بله توی این مثال درست هست تا زمانی که مقدار ساعت وارد نشده باشه . ساعت و دقیقه و ثانیه که وارد بشه بهم میریزه . نهایتا فیلد تاریخ رو از ساعت جدا کردم

@babakhani babakhani changed the title انتخاب اشتباه تاریخ درصورت مقدار داشتن اینپوت در فرم ویرایش initialValue cannot parse time correctly Dec 24, 2017
@samirreza
Copy link

samirreza commented Apr 4, 2018

@babakhani i have the same problem. i test many combination of input field value for showing initial date and time but i cant adjust time properly. what format should i use for this purpose ?
As i see your library have regex for parsing time and regex for parsing date but there is no mechanism for parsing and validating both

@samirreza
Copy link

samirreza commented Apr 4, 2018

@ShariatPanah i find solution with help of php. if you set the value attribute of field with this php method, this library can convert it to formatted value in persian :
date('D M d Y H:i:s O', $value) // $value is the timestamp of datetime field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants