You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2017/10/29 08:21:51 UTC

[royale-asjs] branch develop updated: added date utility package

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9eba333  added date utility package
9eba333 is described below

commit 9eba3339a267b8fac38080682b0ff19f7bb3d81e
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Oct 29 10:21:49 2017 +0200

    added date utility package
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  8 +++++
 .../royale/org/apache/royale/utils/date/addDays.as | 35 ++++++++++++++++++++++
 .../org/apache/royale/utils/date/addHours.as       | 35 ++++++++++++++++++++++
 .../org/apache/royale/utils/date/addMinutes.as     | 35 ++++++++++++++++++++++
 .../org/apache/royale/utils/date/addMonths.as      | 35 ++++++++++++++++++++++
 .../org/apache/royale/utils/date/addSeconds.as     | 35 ++++++++++++++++++++++
 .../org/apache/royale/utils/date/addYears.as       | 34 +++++++++++++++++++++
 7 files changed, 217 insertions(+)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 6853045..4ee4acc 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -227,6 +227,14 @@ internal class CoreClasses
 	import org.apache.royale.debugging.throwError; throwError;
 
 	import org.apache.royale.utils.loadBeadFromValuesManager; loadBeadFromValuesManager;
+
+	import org.apache.royale.utils.date.addDays; addDays;
+	import org.apache.royale.utils.date.addHours; addHours;
+	import org.apache.royale.utils.date.addMinutes; addMinutes;
+	import org.apache.royale.utils.date.addMonths; addMonths;
+	import org.apache.royale.utils.date.addSeconds; addSeconds;
+	import org.apache.royale.utils.date.addYears; addYears;
+
 }
 
 }
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addDays.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addDays.as
new file mode 100644
index 0000000..f08226e
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addDays.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds days to the Date object. By default it adds one day. To subtract days, specify a negative number.
+	 *  Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addDays(date:Date, days:int=1):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setDate(date.getDate() + days);
+		return newDate;
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addHours.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addHours.as
new file mode 100644
index 0000000..c10751b
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addHours.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds hours to the Date object. By default it adds one hour. To subtract hours, specify a negative number.
+	 *  Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addHours(date:Date, hours:int=1):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setHours(date.getHours() + hours);
+		return newDate;
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMinutes.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMinutes.as
new file mode 100644
index 0000000..7f9848f
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMinutes.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds minutes to the Date object. By default it adds one minute. To subtract minutes, specify a negative number.
+	 *  Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addMinutes(date:Date, minutes:int=1):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setMinutes(date.getMinutes() + minutes);
+		return newDate;
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMonths.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMonths.as
new file mode 100644
index 0000000..d1a4e8e
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addMonths.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds months to the Date object. By default it adds one month. To subtract months, specify a negative number.
+	 *  Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addMonths(date:Date, months:int=1):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setMonth(date.getMonth() + months);
+		return newDate;
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addSeconds.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addSeconds.as
new file mode 100644
index 0000000..87070f2
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addSeconds.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds seconds to the Date object. By default it adds one second. To subtract seconds, specify a negative number.
+	 *  Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addSeconds(date:Date, seconds:int=1):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setSeconds(date.getSeconds() + seconds);
+		return newDate;
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addYears.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addYears.as
new file mode 100644
index 0000000..4ef938d
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/date/addYears.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.date
+{
+	/**
+	 *  Adds a day to the Date object. Returns a new Date.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function addYears(date:Date):Date
+    {
+		var newDate:Date = new Date(date.valueOf());
+		newDate.setDate(date.getDate()+1);
+		return newDate;
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].