Bug #3304

Sunstone Accounting inputs shows a wrong format

Added by Ruben S. Montero almost 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:11/06/2014
Priority:HighDue date:
Assignee:Daniel Molina% Done:

100%

Category:Sunstone
Target version:Release 4.10.1
Resolution:fixed Pull request:
Affected Versions:OpenNebula 4.10

Description

Format shown in text input 2014-10-12, valid format 2014/10/12

It may be sensible to timezone


Related issues

Related to Bug #3754: Firefox date formatting incompatible with dateFromString Closed 04/16/2015
Duplicated by Bug #3274: input type date is not supported in firefox and default v... Closed 10/31/2014

Associated revisions

Revision bf43bc0a
Added by Daniel Molina almost 5 years ago

bug #3304: Add support for different time formats in acct inputs

Revision 88235fe9
Added by Daniel Molina almost 5 years ago

bug #3304: Fix acct end_time placeholder

Revision 9326f257
Added by Daniel Molina almost 5 years ago

bug #3304: Add support for different time formats in acct inputs

(cherry picked from commit bf43bc0a0b6a99299b7a35595fc8e1ce02503996)

Revision ac4d7c0b
Added by Daniel Molina almost 5 years ago

bug #3304: Fix acct end_time placeholder

(cherry picked from commit 88235fe9d77e03b6fde48ac45d10e4bb23120798)

History

#1 Updated by Bastien Cadiot almost 5 years ago

We solve this issue with this small patch on "src/sunstone/public/js/sunstone.js" :

--- sunstone.js    2014-11-12 15:09:45.105118368 +0100
+++ patch    2014-11-12 14:41:06.588152638 +0100
@@ -4908,7 +4908,7 @@ function accountingGraphs(div, opt){
     d.setDate(1);
     d.setMonth(d.getMonth() - 1);

-    $("#acct_start_time", div).val(d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0'+d.getDate()).slice(-2));
+    $("#acct_start_time", div).val(d.getFullYear() + '/' + ('0'+(d.getMonth()+1)).slice(-2) + '/' + ('0'+d.getDate()).slice(-2));

     //--------------------------------------------------------------------------
     // Init end time to today
@@ -4916,7 +4916,7 @@ function accountingGraphs(div, opt){

     d = new Date();

-    $("#acct_end_time", div).val(d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0'+d.getDate()).slice(-2));
+    $("#acct_end_time", div).val(d.getFullYear() + '/' + ('0'+(d.getMonth()+1)).slice(-2) + '/' + ('0'+d.getDate()).slice(-2));

     //--------------------------------------------------------------------------
     // VM owner: all, group, user

It seems this works in every tab

#2 Updated by Daniel Molina almost 5 years ago

Hi Bastien,

Thank you for your feedback, have you tested this patch with firefox and chrome?

#3 Updated by Daniel Molina almost 5 years ago

  • Priority changed from Normal to High

#4 Updated by Bastien Cadiot almost 5 years ago

Hi Daniel,

The patch work both for chrome and firefox in my environnement (FR timezone). It solve format incorrect error after loading.

But accounting format is different in each browser :
- In chrome there is a calendar popup and the format is dd/mm/yyyy. "start" and "end" fields display "dd/mm/yyyy" text, no preselected period.
- In firefox, there is no popup, we have to type manually the date. The format is yyyy/mm/dd and if we type in "dd/mm/yyyy", the result is completely false (it show result in 2015...). Today the preselect period is 2014/10/01 to 2014/11/13.

#5 Updated by Ruben S. Montero almost 5 years ago

  • Target version changed from Release 4.12 to Release 4.10.1

#6 Updated by Daniel Molina almost 5 years ago

  • Assignee set to Daniel Molina

#7 Updated by Daniel Molina almost 5 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Resolution set to fixed

Hi,

I have uploaded a patch to fix this issue:
  • If the date input is supported there is a calendar pop up that will allow you to select the date
  • If not, the format is yyyy-mm-dd or yyyy/mm/dd

Thank you for your feedback

#8 Updated by Daniel Molina almost 5 years ago

  • Duplicated by Bug #3274: input type date is not supported in firefox and default value for the input is invalid added

#9 Updated by Daniel Molina over 4 years ago

  • Related to Bug #3754: Firefox date formatting incompatible with dateFromString added

Also available in: Atom PDF