更改 ExtJS 中的日期格式不会更改提交的日期

发布于 2024-12-21 19:55:36 字数 1299 浏览 0 评论 0原文

我正在使用 Extensible 的日历 http://ext.ensible.com/products/calendar/但是当提交事件日期时,它没有使用我想要的 MySQL 后端格式。

我试图让我的可扩展日历日期与我的 mySql 日期格式匹配,但我不知道我是否在正确的位置更改它。

这是我的 EventMappings

Extensible.calendar.data.EventMappings = {
    EventId:     {name: 'EventId', mapping:'id', type:'int'},
    CalendarId:  {name: 'CalendarId', mapping: 'roomId', type: 'int'},
    Title:       {name: 'Title', mapping: 'description'},
    StartDate:   {name: 'StartDate', mapping: 'start', type: 'date', dateFormat: 'Y-m-d H:i:s'},
    EndDate:     {name: 'EndDate', mapping: 'end', type: 'date', dateFormat: 'Y-m-d H:i:s'},
    RRule:       {name: 'RRule', mapping: 'rrule'},
    Notes:       {name: 'Notes', mapping: 'notes'},
    Reminder:    {name: 'Reminder', mapping: ''},
    Location:    {name: 'Location', mapping: ''},
    Url:         {name: 'Url', mapping: ''},
    IsAllDay:     {name: 'IsAllDay', mapping: ''},
    User:   {name: 'User', mapping: 'user'},
    Approved:   {name: 'Approved', mapping:'approved', type:'boolean'}
};

当我尝试向后端发布更新时,尽管日期似乎以这种格式发送 Wed Dec 14 2011 01:00:00 GMT-0500 (EST)

我已经为此绞尽脑汁有一段时间了,但就是想不通。我没有看到其他人遇到同样的问题,所以我假设我在某个地方做错了什么。

任何帮助都会很棒。谢谢。

I'm using Extensible's Calendar http://ext.ensible.com/products/calendar/ but when submitting an event date it's not using the format I'd like for my MySQL backend.

I'm trying to have my Extensible Calendar dates match my mySql date format but I don't know if I'm changing it in the correct spot.

Here is my EventMappings

Extensible.calendar.data.EventMappings = {
    EventId:     {name: 'EventId', mapping:'id', type:'int'},
    CalendarId:  {name: 'CalendarId', mapping: 'roomId', type: 'int'},
    Title:       {name: 'Title', mapping: 'description'},
    StartDate:   {name: 'StartDate', mapping: 'start', type: 'date', dateFormat: 'Y-m-d H:i:s'},
    EndDate:     {name: 'EndDate', mapping: 'end', type: 'date', dateFormat: 'Y-m-d H:i:s'},
    RRule:       {name: 'RRule', mapping: 'rrule'},
    Notes:       {name: 'Notes', mapping: 'notes'},
    Reminder:    {name: 'Reminder', mapping: ''},
    Location:    {name: 'Location', mapping: ''},
    Url:         {name: 'Url', mapping: ''},
    IsAllDay:     {name: 'IsAllDay', mapping: ''},
    User:   {name: 'User', mapping: 'user'},
    Approved:   {name: 'Approved', mapping:'approved', type:'boolean'}
};

When I try to post an update to my backend though the date seems to be sent in this format
Wed Dec 14 2011 01:00:00 GMT-0500 (EST)

I've been banging my head against this for a while and just can't figure it out. I haven't seen anyone else with the same issue so I assuming I'm doing something wrong somewhere.

Any help would be terrific. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

執念 2024-12-28 19:55:36

我遇到了类似的问题,并通过使用相关日历视图(在我的例子中为月视图)的 dateParamFormat 属性解决了它。

{
   xtype: 'extensible.calendarpanel',
   // the usual settings (calendar and event store, etc.) 
   ..
   monthViewCfg: {
     ..
     // This is it - a custom date format
     dateParamFormat: 'Y/m/d'
   }
}

I had a similar problem and solved it by using the dateParamFormat property of the relevant calendar view (month view in my case).

{
   xtype: 'extensible.calendarpanel',
   // the usual settings (calendar and event store, etc.) 
   ..
   monthViewCfg: {
     ..
     // This is it - a custom date format
     dateParamFormat: 'Y/m/d'
   }
}
Spring初心 2024-12-28 19:55:36

您的商店/代理/读取器/写入器配置是什么样的?该问题与 EventMappings(映射从服务器读取的传入数据)无关——它与应用程序中的数据层如何发送请求中的日期有关。另外,您使用哪种操作系统/浏览器?

What does your store / proxy / reader / writer configuration look like? The issue would not be related to the EventMappings (which map incoming data being read from the server) -- it would be related to how the data layer in your app is sending dates in requests. Also, which OS / browser are you using?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文