Comments (7)
Hmm interesting, thanks for finding that. I'll take a look and try to make parseDate a little more robust.
from phreeze.
Hey Arne, would you mind posting a sample date value from your app that was causing problems? I can't reproduce it here, but it's possible there's a DB setting or something perhaps internationalization setting that outputs the dates slightly differently.
Also - is datepicker input control on the edit form showing the correct date? That would be interesting because the datepicker and the table both use the same date parsing function.
thanks again
from phreeze.
Sry for the late reply.
What comes from the API, is what you expect from a MySQL Date column: "2012-08-04"
What gets retrieved by item.get() is also correct: "2012-08-04"
Then its get passed to app.parseDate(), which results in: Fri Sep 07 2012 21:48:21 GMT+0200 (CEST)
Then its gets consumed by _date, resulting in: 1347047395268
After calling .format('YYYY-MM-DD') it becomes: 2012-09-07
So you can see, that the problem is with app.parseDate, which may be localized. I am using Chromium with an english locale in Germany. System time is GMT.
Problem persists between browsers. Not quite sure what causes this behaviour. Appending 00:00:00 however fixed it, as I said in the first post.
from phreeze.
Hmm, thanks for the reply. I'll check that out. Since it returned sept 7 (which is today) then i'm guessing the parse function somehow failed and is returning the current time in order to return a valid date object instead of null or throwing an error.
i really want to reproduce this issue before I fix it so I don't wind up masking some other bug. but i'll try to do a little research into whether Javascript date parsing works differently depending on the browser setup. It looks like having the time in there forces it to parse correctly so that's an option but I just want to make sure I'm solving the root problem and not just a symptom.
from phreeze.
OK found it & fixed in commit 449c1ee - there was a bug in app.js where when no time was provided it was throwing an exception instead of correctly appending the time. app.js is now marked as version 1.1, if you update that file then your project should work.
if you don't want to re-generate your app then you can just replace app.js with the one inside phreeze/builder/code/phreeze.backbone/scripts/app.js
from phreeze.
Well still this behavior is weird. If I have a date in my database that is "NULL" this function displays the current date (Minutes, Hours and Seconds get set to 0).
But still, I would expect 0000-00-00 00:00:00 and not 2012-09-23 00:00:00
from phreeze.
yea i'm not 100% sure what the best scenario for an illegal date in a date column would be. all zeros just gets converted to Nov 30, 1899 12:00 AM, and that's not equivalent to null. So it's probably not much better. If you wanted all zeros, though, that could be something done in the server side model code or something in "OnLoad"
I do agree that there should be some indication to the user that the date was adjusted. I don't like it when data is adjusted - even though it does write a warning to the console, the user probably won't notice that. Perhaps a validation warning could appear next to the date picker or something.
I'd say if you need to store null in date fields then it would probably require a UI that detects it and has some kind of date picker that supports null values (though i don't know of any personally).
from phreeze.
Related Issues (20)
- Greetings HOT 1
- Error after building
- Its work wordpress 4.8+?
- Phreeze Builder Broken HOT 1
- master-detail / master-detail-detail examples
- builder/analyze gives 404 on Nginx
- Generated code in scripts/model.js displays all tables regardless
- index null HOT 1
- Controler filename / classname containing space character(s)
- Stuck loading tables with varbinary?
- Error Opening MySQL Database HOT 1
- analyze Not Found HOT 1
- after instalation HOT 2
- Undefined offset: 1 in DBTable.php at line 285 HOT 1
- Jason Hinkle 1970-2016 HOT 5
- Security issue : use hash_equals() instead of '===' to compare hashes
- Show on select many-to-one
- http://192.168.32.10/phreeze/builder/analyze HOT 1
- Foreign key issue
- Problem after builder page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phreeze.