refs #6200 style fixes, mock local date
gitea/hedera-web/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-10-09 21:01:11 +02:00
parent 3977b258d3
commit 4a09fe39a8
13 changed files with 56 additions and 46 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (23.40.2) stable; urgency=low hedera-web (23.40.3) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -7,8 +7,8 @@ export default new Class({
,activate() { ,activate() {
if (!this.hash.$.to) if (!this.hash.$.to)
this.hash.assign({ this.hash.assign({
from: new Date(), from: Date.vnNew(),
to: new Date() to: Date.vnNew()
}); });
} }
}); });

View File

@ -14,7 +14,7 @@ export default new Class({
,refreshCaptcha() { ,refreshCaptcha() {
params = { params = {
srv: 'rest:misc/captcha', srv: 'rest:misc/captcha',
stamp: new Date().getTime() stamp: Date.vnNew().getTime()
}; };
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params); this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
} }

View File

@ -193,16 +193,18 @@
margin-bottom: 1px; margin-bottom: 1px;
} }
& > .min-quantity { & > .min-quantity {
bottom: 30px; bottom: 32px;
right: 0; right: 0;
} }
} }
.min-quantity { .min-quantity {
position: absolute; position: absolute;
display: none;
bottom: 30px; bottom: 30px;
right: 0; right: 0;
font-size: .8rem; font-size: .8rem;
color: #c44;
& > span { & > span {
font-size: 16px; font-size: 16px;

View File

@ -469,10 +469,10 @@
</custom> </custom>
</htk-repeater> </htk-repeater>
<div id="card-min-quantity" class="min-quantity" title="_MinimalQuantity"> <div id="card-min-quantity" class="min-quantity" title="_MinimalQuantity">
{{card.minQuantity}}
<span class="htk-icon material-symbols-rounded"> <span class="htk-icon material-symbols-rounded">
production_quantity_limits production_quantity_limits
</span> </span>
{{card.minQuantity}}
</div> </div>
</div> </div>
<htk-grid class="lots-grid" show-header="false"> <htk-grid class="lots-grid" show-header="false">

View File

@ -8,7 +8,7 @@ export default new Class({
this.autoStepLocked = true; this.autoStepLocked = true;
this.$.assistant.stepsIndex = this.agencySteps; this.$.assistant.stepsIndex = this.agencySteps;
this.today = new Date(); this.today = Date.vnNew();
this.today.setHours(0, 0, 0, 0); this.today.setHours(0, 0, 0, 0);
}, },
@ -22,8 +22,8 @@ export default new Class({
let date; let date;
const row = orderForm.$ || defaultsForm.$ || {}; const row = orderForm.$ || defaultsForm.$ || {};
if (!date || date.getTime() < (new Date()).getTime()) { if (!date || date.getTime() < (Date.vnNew()).getTime()) {
date = new Date(); date = Date.vnNew();
date.setHours(0, 0, 0, 0); date.setHours(0, 0, 0, 0);
let addDays = 0; let addDays = 0;

View File

@ -6,7 +6,7 @@ export default new Class({
activate() { activate() {
this.$.lot.assign({ this.$.lot.assign({
date: new Date(), date: Date.vnNew(),
useIds: false useIds: false
}); });
}, },

View File

@ -141,7 +141,7 @@ module.exports = new Class({
} }
,goToCurrentMonth() { ,goToCurrentMonth() {
var date = new Date(); var date = Date.vnNew();
this.goToMonth(date.getFullYear(), date.getMonth()); this.goToMonth(date.getFullYear(), date.getMonth());
} }
@ -179,7 +179,7 @@ module.exports = new Class({
// Marks the current day // Marks the current day
var today = new Date(); var today = Date.vnNew();
if (this.year == today.getFullYear() if (this.year == today.getFullYear()
&& this.month == today.getMonth()) { && this.month == today.getMonth()) {

View File

@ -192,7 +192,7 @@ module.exports = new Class({
} }
,_onFileUpload(cell) { ,_onFileUpload(cell) {
this._stamp = new Date().getTime(); this._stamp = Date.vnNew().getTime();
this._refreshSrc(cell); this._refreshSrc(cell);
this.popup.hide(); this.popup.hide();
} }

View File

@ -3,69 +3,61 @@
*/ */
module.exports = module.exports =
{ {
set: function (key, value, days) set: function(key, value, days) {
{
var strCookie = key + '=' + value + ';'; var strCookie = key + '=' + value + ';';
if (days != undefined) if (days != undefined) {
{ var date = Date.vnNew();
var date = new Date (); date.setTime(date.getTime() + days * 86400000);
date.setTime (date.getTime () + days * 86400000); strCookie += 'expires=' + date.toGMTString();
strCookie += 'expires=' + date.toGMTString ();
} }
document.cookie = strCookie; document.cookie = strCookie;
} }
,unset: function (key) ,unset: function(key) {
{ this.set(key, '', -1);
this.set (key, '', -1);
} }
,get: function (key) ,get: function(key) {
{ var cookie = new String(document.cookie);
var cookie = new String (document.cookie); var start = cookie.indexOf(key + '=');
var start = cookie.indexOf (key + '=');
if (start != -1) if (start != -1) {
{
var end; var end;
start += key.length + 1; start += key.length + 1;
end = cookie.indexOf (';', start); end = cookie.indexOf(';', start);
if (end > 0) if (end > 0)
return cookie.substring (start, end); return cookie.substring(start, end);
else else
return cookie.substring (start); return cookie.substring(start);
} }
return null; return null;
} }
,getInt: function (key) ,getInt: function(key) {
{ var value = this.get(key);
var value = this.get (key);
if (value != null) if (value != null)
return parseInt (value); return parseInt(value);
return null; return null;
} }
,getFloat: function (key) ,getFloat: function(key) {
{ var value = this.get(key);
var value = this.get (key);
if (value != null) if (value != null)
return parseFloat (value); return parseFloat(value);
return null; return null;
} }
,check: function (key) ,check: function(key) {
{ return this.get(key) != null;
return this.get (key) != null;
} }
}; };

View File

@ -6,6 +6,22 @@ Date.prototype.clone = function() {
return new Date(this.getTime()); return new Date(this.getTime());
} }
Date.vnUTC = () => {
const env = process.env.NODE_ENV;
if (!env || env === 'development')
return new Date(Date.UTC(2001, 0, 1, 11));
return new Date();
};
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};
module.exports = module.exports =
{ {
WDays: [ WDays: [

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "23.40.2", "version": "23.40.3",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -18,7 +18,7 @@ class Segment {
switch ($type) { switch ($type) {
case Type::DATE: case Type::DATE:
$tmp = new Date(); $tmp = Date.vnNew();
$tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2)); $tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2));
return $tmp; return $tmp;
case Type::TIME: case Type::TIME: