lesli_date 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lesli_date/formatter.rb +12 -3
- data/lib/lesli_date/version.rb +2 -2
- data/lib/lesli_date.rb +6 -0
- data/readme.md +37 -18
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d046a707bc5a73febdde178a54e4e1442d5c23363d841a4fa84b303596cfe27
|
|
4
|
+
data.tar.gz: 6892b79caea542404efd47199021715018dc7a954bd2ed189beab24193cda3a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1265c6d43a4e98c892485cc529c471c267deea07282764f834fe1d545245b49c74848026fb4ce6e1a7b7bc9c0e94e816d805d0f02a8e7f98aab5e877ffe50d1
|
|
7
|
+
data.tar.gz: a40d0aa2c27131dab48338bdae7fdddedde4b02983f1440014f8bea3978fc7c8e02334173915dd2ccaa0817bae7f5848afee18bc63e2b86bdabe773d3fb87bef
|
data/lib/lesli_date/formatter.rb
CHANGED
|
@@ -117,12 +117,20 @@ module LesliDate
|
|
|
117
117
|
# get right format for dates
|
|
118
118
|
format = self.db_format
|
|
119
119
|
|
|
120
|
+
# compatibility for SQLite
|
|
121
|
+
if ActiveRecord::Base.connection.adapter_name == "SQLite"
|
|
122
|
+
offset = ActiveSupport::TimeZone[@settings[:time_zone]].utc_offset / 3600
|
|
123
|
+
return "strftime('#{format}', #{table}created_at, '#{offset} hours') as created_at_string"
|
|
124
|
+
end
|
|
125
|
+
|
|
120
126
|
"TO_CHAR(#{table}created_at at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as created_at_date, TO_CHAR(#{table}updated_at at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as updated_at_date"
|
|
121
127
|
|
|
122
128
|
end
|
|
123
129
|
|
|
124
130
|
# return query string to get a datetime column from database
|
|
125
|
-
def db_column column, table=""
|
|
131
|
+
def db_column column, table="", as:nil
|
|
132
|
+
|
|
133
|
+
as = "#{column}_string" unless as
|
|
126
134
|
|
|
127
135
|
# avoid ambiguous columns
|
|
128
136
|
table = table.concat(".") if table != ""
|
|
@@ -132,10 +140,11 @@ module LesliDate
|
|
|
132
140
|
|
|
133
141
|
# compatibility for SQLite
|
|
134
142
|
if ActiveRecord::Base.connection.adapter_name == "SQLite"
|
|
135
|
-
|
|
143
|
+
offset = ActiveSupport::TimeZone[@settings[:time_zone]].utc_offset / 3600
|
|
144
|
+
return "strftime('#{format}', #{table}#{column}, '#{offset} hours') as #{as}"
|
|
136
145
|
end
|
|
137
146
|
|
|
138
|
-
"TO_CHAR(#{table}#{column} at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as #{
|
|
147
|
+
"TO_CHAR(#{table}#{column} at time zone 'utc' at time zone '#{@settings[:time_zone]}', '#{format}') as #{as}"
|
|
139
148
|
|
|
140
149
|
end
|
|
141
150
|
|
data/lib/lesli_date/version.rb
CHANGED
data/lib/lesli_date.rb
CHANGED
data/readme.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<div align="center">
|
|
1
|
+
<div align="center" class="documentation-header">
|
|
3
2
|
<img width="100" alt="LesliDate logo" src="./docs/images/date-logo.svg" />
|
|
4
3
|
<h3 align="center">Standard Datetime Formatter for The Lesli Framework.</h3>
|
|
5
4
|
</div>
|
|
@@ -7,21 +6,25 @@
|
|
|
7
6
|
<br />
|
|
8
7
|
<hr/>
|
|
9
8
|
|
|
10
|
-
<
|
|
11
|
-
<a target="blank" href="https://
|
|
12
|
-
<img
|
|
9
|
+
<div align="center" class="documentation-statics">
|
|
10
|
+
<a target="blank" href="https://github.com/LesliTech/LesliDate/actions">
|
|
11
|
+
<img alt="Tests passing" src="https://img.shields.io/badge/Tests-passing-green?style=for-the-badge&logo=github">
|
|
12
|
+
</a>
|
|
13
|
+
<a target="blank" href="https://rubygems.org/gems/lesli_date">
|
|
14
|
+
<img alt="Gem Version" src="https://img.shields.io/gem/v/lesli_date?style=for-the-badge&logo=ruby">
|
|
13
15
|
</a>
|
|
14
|
-
<a
|
|
15
|
-
<img
|
|
16
|
+
<a target="blank" href="https://codecov.io/github/LesliTech/LesliDate">
|
|
17
|
+
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/LesliTech/LesliDate?style=for-the-badge&logo=codecov">
|
|
16
18
|
</a>
|
|
17
|
-
<a href="https://
|
|
18
|
-
<img
|
|
19
|
+
<a target="blank" href="https://sonarcloud.io/project/overview?id=LesliTech_LesliView">
|
|
20
|
+
<img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/LesliTech_LesliView?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud&label=Quality">
|
|
19
21
|
</a>
|
|
20
|
-
</
|
|
22
|
+
</div>
|
|
21
23
|
|
|
22
24
|
<hr/>
|
|
23
25
|
<br />
|
|
24
26
|
|
|
27
|
+
|
|
25
28
|
### Quick start
|
|
26
29
|
|
|
27
30
|
```shell
|
|
@@ -29,22 +32,32 @@
|
|
|
29
32
|
bundle add lesli_date
|
|
30
33
|
```
|
|
31
34
|
|
|
35
|
+
|
|
36
|
+
<br />
|
|
37
|
+
<hr/>
|
|
38
|
+
<br />
|
|
39
|
+
|
|
40
|
+
### Demo
|
|
41
|
+
|
|
42
|
+
* [online demo](https://demo.lesli.dev/)
|
|
43
|
+
* [docker demo](https://github.com/LesliTech/lesli-docker-demo)
|
|
44
|
+
|
|
45
|
+
|
|
32
46
|
### Documentation
|
|
33
47
|
* [website](https://www.lesli.dev/)
|
|
34
|
-
* [
|
|
35
|
-
* [documentation](https://www.lesli.dev/gems/gems/)
|
|
48
|
+
* [documentation](https://www.lesli.dev/gems/date/)
|
|
36
49
|
|
|
37
50
|
|
|
38
|
-
###
|
|
51
|
+
### Connect with Lesli
|
|
39
52
|
|
|
53
|
+
* [X: @LesliTech](https://x.com/LesliTech)
|
|
40
54
|
* [Email: hello@lesli.tech](hello@lesli.tech)
|
|
41
55
|
* [Website: https://www.lesli.tech](https://www.lesli.tech)
|
|
42
|
-
* [Twitter: @LesliTech](https://twitter.com/LesliTech)
|
|
43
56
|
|
|
44
57
|
|
|
45
58
|
### License
|
|
46
59
|
-------
|
|
47
|
-
Copyright (c)
|
|
60
|
+
Copyright (c) 2026, Lesli Technologies, S. A.
|
|
48
61
|
|
|
49
62
|
This program is free software: you can redistribute it and/or modify
|
|
50
63
|
it under the terms of the GNU General Public License as published by
|
|
@@ -59,11 +72,17 @@ GNU General Public License for more details.
|
|
|
59
72
|
You should have received a copy of the GNU General Public License
|
|
60
73
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
61
74
|
|
|
75
|
+
<br />
|
|
62
76
|
<hr />
|
|
63
77
|
<br />
|
|
78
|
+
<br />
|
|
64
79
|
|
|
65
|
-
<
|
|
80
|
+
<div align="center" class="has-text-centered">
|
|
66
81
|
<img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
|
|
67
|
-
<
|
|
68
|
-
|
|
82
|
+
<h3 align="center" class="mt-0">
|
|
83
|
+
The Open-Source SaaS Development Framework for Ruby on Rails.
|
|
84
|
+
</h3>
|
|
85
|
+
</div>
|
|
69
86
|
|
|
87
|
+
<br />
|
|
88
|
+
<br />
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lesli_date
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Lesli Development Team
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Datetime formatter and SQL-safe utilities for Rails, part of the LesliSystem
|
|
14
13
|
email:
|
|
@@ -31,7 +30,6 @@ metadata:
|
|
|
31
30
|
homepage_uri: https://www.lesli.dev/
|
|
32
31
|
changelog_uri: https://github.com/LesliTech/LesliDate
|
|
33
32
|
source_code_uri: https://github.com/LesliTech/LesliDate
|
|
34
|
-
post_install_message:
|
|
35
33
|
rdoc_options: []
|
|
36
34
|
require_paths:
|
|
37
35
|
- lib
|
|
@@ -46,8 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
46
44
|
- !ruby/object:Gem::Version
|
|
47
45
|
version: '0'
|
|
48
46
|
requirements: []
|
|
49
|
-
rubygems_version: 3.
|
|
50
|
-
signing_key:
|
|
47
|
+
rubygems_version: 3.7.1
|
|
51
48
|
specification_version: 4
|
|
52
49
|
summary: Standard Datetime Formatter for The Lesli Framework.
|
|
53
50
|
test_files: []
|